A helper class to synchronize printing to an output stream by different threads.
More...
#include <ThreadPool.hpp>
|
| | synced_stream (std::ostream &_out_stream=std::cout) |
| | Construct a new synced stream. More...
|
| |
| template<typename... T> |
| void | print (const 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 this synced_stream object to print. More...
|
| |
| template<typename... T> |
| void | println (const 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 this synced_stream object to print. More...
|
| |
A helper class to synchronize printing to an output stream by different threads.
◆ synced_stream()
| mltk::synced_stream::synced_stream |
( |
std::ostream & |
_out_stream = std::cout | ) |
|
|
inline |
Construct a new synced stream.
- Parameters
-
| _out_stream | The output stream to print to. The default value is std::cout. |
◆ print()
template<typename... T>
| void mltk::synced_stream::print |
( |
const 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 this synced_stream object to print.
- Template Parameters
-
- Parameters
-
◆ println()
template<typename... T>
| void mltk::synced_stream::println |
( |
const 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 this synced_stream object to print.
- Template Parameters
-
- Parameters
-
The documentation for this class was generated from the following file: