29 Input/output library [input.output]

29.10 Synchronized output streams [syncstream]

29.10.2 Class template basic_­syncbuf [syncstream.syncbuf]

29.10.2.4 Member functions [syncstream.syncbuf.members]

bool emit();
Effects: Atomically transfers the associated output of *this to the stream buffer *wrapped, so that it appears in the output stream as a contiguous sequence of characters.
wrapped->pubsync() is called if and only if a call was made to sync() since the most recent call to emit(), if any.
Postconditions: On success, the associated output is empty.
Returns: true if all of the following conditions hold; otherwise false:
  • wrapped == nullptr is false.
  • All of the characters in the associated output were successfully transferred.
  • The call to wrapped->pubsync() (if any) succeeded.
Synchronization: All emit() calls transferring characters to the same stream buffer object appear to execute in a total order consistent with the โ€œhappens beforeโ€ relation ([intro.races]), where each emit() call synchronizes with subsequent emit() calls in that total order.
Remarks: May call member functions of wrapped while holding a lock uniquely associated with wrapped.
streambuf_type* get_wrapped() const noexcept;
Returns: wrapped.
allocator_type get_allocator() const noexcept;
Returns: A copy of the allocator that was set in the constructor or assignment operator.
void set_emit_on_sync(bool b) noexcept;
Effects: emit_­on_­sync = b.