18#ifndef LIBMESH_THREAD_BUFFERED_SYNCBUF_H
19#define LIBMESH_THREAD_BUFFERED_SYNCBUF_H
25#include "libmesh/threads_spin_mutex_forward.h"
42 int_type
overflow(int_type ch)
override;
45 std::streamsize
xsputn(
const char * s, std::streamsize n)
override;
89 std::unique_ptr<Threads::spin_mutex>
_mu;
A class that wraps a thread-local string.
ThreadBufferedSyncbuf & _owner
owning syncing stream buffer
ThreadLocalBuffer(ThreadBufferedSyncbuf &owner)
~ThreadLocalBuffer()
Ensures we write to our sink upon destruction if our buf is non-empty.
std::string buf
per-thread buffer
std::streamsize xsputn(const char *s, std::streamsize n) override
std::unique_ptr< Threads::spin_mutex > _mu
Serialization for commits to the shared sink.
ThreadLocalBuffer & thread_local_buffer()
One ThreadLocalBuffer instance per thread, constructed on first use with *this.
~ThreadBufferedSyncbuf()
Defaulted destructor defined in implementation so we don't need to include threads....
int_type overflow(int_type ch) override
void emit_from_thread_local_buffer(std::string &b, bool force_flush)
Emit from the thread local buffer to our wrapped _sink.
std::streambuf & _sink
Wrapped output sink.
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.