ISO/IEC JTC1 SC22 WG21 N3665 - 2013-04-19
Lawrence Crowl, firstname.lastname@example.org, Lawrence@Crowl.org
At present, synchronized stream output operations guarantee that they will not produce race conditions, but do not guarantee that the resulting character sequence will be sensible. Some form of synchronization is required. Unfortunately, without a standard mechanism for synchronizing, independently developed software will be unable to synchronize.
We propose to require sufficiently small strings output to a stream to appear as an uninterleaved whole in the output. This is the minimum change necessary to solve the most pressing problem.
The code generally required on the part of the programmer
to synchronize a sequence of stream operations to an
declare a local
stream to that
and when done,
stream the entire contents of the
To make implementation reasonable,
we restrict the size of the string to less than
This wording is relative to N3485.
Edit paragraph 4 as follows.
Concurrent access to a synchronized (18.104.22.168) standard iostream object's formatted and unformatted input (22.214.171.124) and output (126.96.36.199) functions or a standard C stream by multiple threads shall not result in a data race (1.10). [Note: Users must still synchronize concurrent use of these objects and streams by multiple threads if they wish to avoid interleaved characters. —end note]