29
Input/output library
[input.output]
29.2
Iostreams requirements
[iostreams.requirements]
29.2.3
Thread safety
[iostreams.threadsafety]
1
#
Concurrent access to a stream object (
[string.
streams]
,
[file.
streams]
), stream buffer object (
[stream.
buffers]
), or C Library stream (
[c.
files]
) by multiple threads may result in a data race (
[intro.
multithread]
) unless otherwise specified (
[iostream.
objects]
)
.
[
Note
1
:
Data races result in undefined behavior (
[intro.
multithread]
)
.
—
end note
]
2
#
If one thread makes a library call
a
that writes a value to a stream and, as a result, another thread reads this value from the stream through a library call
b
such that this does not result in a data race, then
a
's write synchronizes with
b
's read
.