Files | |
file | fatal-impl.cc |
ns3::FatalImpl::RegisterStream(), ns3::FatalImpl::UnregisterStream(), and ns3::FatalImpl::FlushStreams() implementations; see Implementation note! | |
file | fatal-impl.h |
ns3::FatalImpl::RegisterStream(), ns3::FatalImpl::UnregisterStream(), and ns3::FatalImpl::FlushStreams() declarations. | |
Functions | |
void | ns3::FatalImpl::FlushStreams (void) |
Flush all currently registered streams. More... | |
std::list< std::ostream * > * | ns3::FatalImpl::anonymous_namespace{fatal-impl.cc}::GetStreamList (void) |
Get the stream list, initializing it if necessary. More... | |
std::list< std::ostream * > ** | ns3::FatalImpl::anonymous_namespace{fatal-impl.cc}::PeekStreamList (void) |
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... | |
void ns3::FatalImpl::FlushStreams | ( | void | ) |
Flush all currently registered streams.
This function iterates through each registered stream and unregisters them. The default SIGSEGV
handler is overridden when this function is being executed, and will be restored when this function returns.
If a SIGSEGV
is encountered (most likely due to a bad ostream*
being registered, or a registered osteam*
pointing to an ostream
that had already been destroyed), this function will skip the bad ostream*
and continue to flush the next stream. The function will then terminate raising SIGIOT
(aka SIGABRT
)
DO NOT call this function until the program is ready to crash.
Definition at line 149 of file fatal-impl.cc.
References NS_LOG_FUNCTION_NOARGS, ns3::FatalImpl::anonymous_namespace{fatal-impl.cc}::PeekStreamList(), and ns3::FatalImpl::anonymous_namespace{fatal-impl.cc}::sigHandler().
Referenced by ns3::FatalImpl::anonymous_namespace{fatal-impl.cc}::sigHandler().
std::list<std::ostream*>* ns3::FatalImpl::anonymous_namespace{fatal-impl.cc}::GetStreamList | ( | void | ) |
Get the stream list, initializing it if necessary.
Definition at line 86 of file fatal-impl.cc.
References NS_LOG_FUNCTION_NOARGS, and ns3::FatalImpl::anonymous_namespace{fatal-impl.cc}::PeekStreamList().
Referenced by ns3::FatalImpl::RegisterStream().
std::list<std::ostream*>** ns3::FatalImpl::anonymous_namespace{fatal-impl.cc}::PeekStreamList | ( | void | ) |
Static variable pointing to the list of output streams to be flushed on fatal errors.
Definition at line 73 of file fatal-impl.cc.
References NS_LOG_FUNCTION_NOARGS.
Referenced by ns3::FatalImpl::FlushStreams(), ns3::FatalImpl::anonymous_namespace{fatal-impl.cc}::GetStreamList(), and ns3::FatalImpl::UnregisterStream().
void ns3::FatalImpl::RegisterStream | ( | std::ostream * | stream | ) |
Register a stream to be flushed on abnormal exit.
If a std::terminate()
call is encountered after the stream had been registered and before it has been unregistered, stream->flush()
will be called. Users of this function should ensure the stream remains valid until it had been unregistered.
[in] | stream | The stream to be flushed on abnormal exit. |
Definition at line 100 of file fatal-impl.cc.
References ns3::FatalImpl::anonymous_namespace{fatal-impl.cc}::GetStreamList(), and NS_LOG_FUNCTION.
Referenced by ns3::AsciiFile::AsciiFile(), ns3::OutputStreamWrapper::OutputStreamWrapper(), and ns3::PcapFile::PcapFile().
void ns3::FatalImpl::anonymous_namespace{fatal-impl.cc}::sigHandler | ( | int | sig | ) |
Overrides normal SIGSEGV handler once the HandleTerminate function is run.
This is private to the fatal implementation.
[in] | sig | The signal condition. |
Definition at line 140 of file fatal-impl.cc.
References ns3::FatalImpl::FlushStreams(), and NS_LOG_FUNCTION.
Referenced by ns3::FatalImpl::FlushStreams().
void ns3::FatalImpl::UnregisterStream | ( | std::ostream * | stream | ) |
Unregister a stream for flushing on abnormal exit.
After a stream had been unregistered, stream->flush()
will no longer be called should abnormal termination be encountered.
If the stream is not registered, nothing will happen.
[in] | stream | The stream to be unregistered. |
Definition at line 107 of file fatal-impl.cc.
References NS_LOG_FUNCTION, and ns3::FatalImpl::anonymous_namespace{fatal-impl.cc}::PeekStreamList().
Referenced by ns3::AsciiFile::~AsciiFile(), ns3::OutputStreamWrapper::~OutputStreamWrapper(), and ns3::PcapFile::~PcapFile().