A helper class to synchronize printing to an output stream by different threads.
More...
#include <BS_thread_pool.hpp>
|
| synced_stream (std::ostream &out_stream_=std::cout) |
| Construct a new synced stream. More...
|
|
template<typename... T> |
void | print (T &&... items) |
| Print any number of items into the output stream. Ensures that no other threads print to this stream simultaneously, as long as they all exclusively use the same synced_stream object to print. More...
|
|
template<typename... T> |
void | println (T &&... items) |
| Print any number of items into the output stream, followed by a newline character. Ensures that no other threads print to this stream simultaneously, as long as they all exclusively use the same synced_stream object to print. More...
|
|
|
static std::ostream &(&) | endl (std::ostream &) = static_cast<std::ostream& (&)(std::ostream&)>(std::endl) |
| A stream manipulator to pass to a synced_stream (an explicit cast of std::endl). Prints a newline character to the stream, and then flushes it. Should only be used if flushing is desired, otherwise '
' should be used instead.
|
|
static std::ostream &(&) | flush (std::ostream &) = static_cast<std::ostream& (&)(std::ostream&)>(std::flush) |
| A stream manipulator to pass to a synced_stream (an explicit cast of std::flush). Used to flush the stream.
|
|
A helper class to synchronize printing to an output stream by different threads.
◆ synced_stream()
Construct a new synced stream.
- Parameters
-
out_stream_ | The output stream to print to. The default value is std::cout. |
◆ print()
void print |
( |
T &&... |
items | ) |
|
|
inline |
Print any number of items into the output stream. Ensures that no other threads print to this stream simultaneously, as long as they all exclusively use the same synced_stream object to print.
- Template Parameters
-
- Parameters
-
◆ println()
void println |
( |
T &&... |
items | ) |
|
|
inline |
Print any number of items into the output stream, followed by a newline character. Ensures that no other threads print to this stream simultaneously, as long as they all exclusively use the same synced_stream object to print.
- Template Parameters
-
- Parameters
-
The documentation for this class was generated from the following file: