18 #ifndef LIBMESH_THREAD_BUFFERED_SYNCBUF_H 19 #define LIBMESH_THREAD_BUFFERED_SYNCBUF_H 44 int_type
overflow(int_type ch)
override;
47 std::streamsize
xsputn(
const char * s, std::streamsize n)
override;
91 std::unique_ptr<Threads::spin_mutex>
_mu;
95 #endif // LIBMESH_THREAD_BUFFERED_SYNCBUF_H
ThreadBufferedSyncbuf(std::streambuf &sink, bool flush_on_newline=true)
ThreadLocalBuffer(ThreadBufferedSyncbuf &owner)
const bool _flush_on_newline
Whether to flush our sink to terminal/file on terminating new-line characters ( ) ...
The libMesh namespace provides an interface to certain functionality in the library.
ThreadLocalBuffer & thread_local_buffer()
One ThreadLocalBuffer instance per thread, constructed on first use with *this.
void emit_from_thread_local_buffer(std::string &b, bool force_flush)
Emit from the thread local buffer to our wrapped _sink.
~ThreadLocalBuffer()
Ensures we write to our sink upon destruction if our buf is non-empty.
std::unique_ptr< Threads::spin_mutex > _mu
Serialization for commits to the shared sink.
std::streambuf & _sink
Wrapped output sink.
int_type overflow(int_type ch) override
ThreadBufferedSyncbuf & _owner
owning syncing stream buffer
~ThreadBufferedSyncbuf()
Defaulted destructor defined in implementation so we don't need to include threads.h.
std::streamsize xsputn(const char *s, std::streamsize n) override
tbb::spin_mutex spin_mutex
Spin mutex.
std::string buf
per-thread buffer
A class that wraps a thread-local string.