This class is used to handle syncronizized output of logging output in a multi-threaded environment. More...
#include <mia/core/threadedmsg.hh>
Inherits ostream.
Public Member Functions | |
CThreadMsgStream () | |
~CThreadMsgStream () | |
Static Public Member Functions | |
template<typename OS > | |
static void | set_master_stream (OS &master) |
Friends | |
template<typename OS , typename placeholder > | |
struct | __dispatch_set_master_stream |
This class is used to handle syncronizized output of logging output in a multi-threaded environment.
This class is used to syncronize the output of the logging stream cverb and its helper functions cvmsg(), cvdebug(), cverror(), cvwarning() ...
To use it, just declare a variable of type CThreadMsgStream at the beginning of the threaded function. Output is only written to the master output stream if a newline is sent or explicit syncronization via flush() is requested.
Note, that a CThreadMsgStream itself can not serve as master stream since it would deadlock.
Definition at line 44 of file threadedmsg.hh.
CThreadMsgStream::CThreadMsgStream | ( | ) |
Constructor. This constructor sets the thread-local output of the vstream backend to itself and saves to old output.
CThreadMsgStream::~CThreadMsgStream | ( | ) |
Destructor. This destructor flushes the output and then resets the thread-local vstream backend to the original output.
|
static |
Set the master output stream. The default is std::cerr.
master | the new master output stream; |
Definition at line 108 of file threadedmsg.hh.
References NS_MIA_END.
|
friend |
Definition at line 66 of file threadedmsg.hh.