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. | |
Namespaces | |
namespace | ns3::FatalImpl |
Implementation namespace for fatal error handlers. | |
namespace | 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. | |
std::list< std::ostream * > * | ns3::FatalImpl::anonymous_namespace{fatal-impl.cc}::GetStreamList () |
Get the stream list, initializing it if necessary. | |
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. | |
void | ns3::FatalImpl::RegisterStream (std::ostream *stream) |
Register a stream to be flushed on abnormal exit. | |
void | ns3::FatalImpl::anonymous_namespace{fatal-impl.cc}::sigHandler (int sig) |
Overrides normal SIGSEGV handler once the HandleTerminate function is run. | |
void | ns3::FatalImpl::UnregisterStream (std::ostream *stream) |
Unregister a stream for flushing on abnormal exit. | |
void ns3::FatalImpl::FlushStreams | ( | ) |
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 176 of file fatal-impl.cc.
References NS_LOG_FUNCTION_NOARGS.
Referenced by ns3::FatalImpl::anonymous_namespace{fatal-impl.cc}::sigHandler().
std::list< std::ostream * > * ns3::FatalImpl::anonymous_namespace{fatal-impl.cc}::GetStreamList | ( | ) |
Get the stream list, initializing it if necessary.
Definition at line 111 of file fatal-impl.cc.
References ns3::FatalImpl::anonymous_namespace{fatal-impl.cc}::GetStreamList(), NS_LOG_FUNCTION_NOARGS, and ns3::FatalImpl::anonymous_namespace{fatal-impl.cc}::PeekStreamList().
Referenced by ns3::FatalImpl::anonymous_namespace{fatal-impl.cc}::GetStreamList().
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.
Definition at line 97 of file fatal-impl.cc.
References NS_LOG_FUNCTION_NOARGS, and ns3::FatalImpl::anonymous_namespace{fatal-impl.cc}::PeekStreamList().
Referenced by ns3::FatalImpl::anonymous_namespace{fatal-impl.cc}::GetStreamList(), and ns3::FatalImpl::anonymous_namespace{fatal-impl.cc}::PeekStreamList().
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 125 of file fatal-impl.cc.
References NS_LOG_FUNCTION.
Referenced by ns3::AsciiFile::AsciiFile(), ns3::OutputStreamWrapper::OutputStreamWrapper(), 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 167 of file fatal-impl.cc.
References ns3::FatalImpl::FlushStreams(), NS_LOG_FUNCTION, and ns3::FatalImpl::anonymous_namespace{fatal-impl.cc}::sigHandler().
Referenced by ns3::FatalImpl::anonymous_namespace{fatal-impl.cc}::sigHandler().
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 132 of file fatal-impl.cc.
References NS_LOG_FUNCTION.
Referenced by ns3::AsciiFile::~AsciiFile(), ns3::OutputStreamWrapper::~OutputStreamWrapper(), and ns3::PcapFile::~PcapFile().