ns3::FatalImpl::RegisterStream(), ns3::FatalImpl::UnregisterStream(), and ns3::FatalImpl::FlushStreams() implementations; see Implementation note! More...
#include "fatal-impl.h"
#include "log.h"
#include <csignal>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <list>
Go to the source code of this file.
Namespaces | |
ns3 | |
Every class exported by the ns3 library is enclosed in the ns3 namespace. | |
ns3::FatalImpl | |
Implementation namespace for fatal error handlers. | |
ns3::FatalImpl::anonymous_namespace{fatal-impl.cc} | |
Unnamed namespace for fatal streams memory implementation and signal handler. | |
Functions | |
void | ns3::FatalImpl::FlushStreams () |
Flush all currently registered streams. More... | |
std::list< std::ostream * > * | ns3::FatalImpl::anonymous_namespace{fatal-impl.cc}::GetStreamList () |
Get the stream list, initializing it if necessary. More... | |
std::list< std::ostream * > ** | ns3::FatalImpl::anonymous_namespace{fatal-impl.cc}::PeekStreamList () |
Static variable pointing to the list of output streams to be flushed on fatal errors. More... | |
void | ns3::FatalImpl::RegisterStream (std::ostream *stream) |
Register a stream to be flushed on abnormal exit. More... | |
void | ns3::FatalImpl::anonymous_namespace{fatal-impl.cc}::sigHandler (int sig) |
Overrides normal SIGSEGV handler once the HandleTerminate function is run. More... | |
void | ns3::FatalImpl::UnregisterStream (std::ostream *stream) |
Unregister a stream for flushing on abnormal exit. More... | |
ns3::FatalImpl::RegisterStream(), ns3::FatalImpl::UnregisterStream(), and ns3::FatalImpl::FlushStreams() implementations; see Implementation note!
The singleton pattern we use here is tricky because we have to ensure:
main()
enters and before any constructor run in this file.new
is deleted properly before program exit.This is why we go through all the painful hoops below.
Definition in file fatal-impl.cc.