Init
This commit is contained in:
29
cppdraft/iostreams/threadsafety.md
Normal file
29
cppdraft/iostreams/threadsafety.md
Normal file
@@ -0,0 +1,29 @@
|
||||
[iostreams.threadsafety]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.2 Iostreams requirements [[iostreams.requirements]](iostreams.requirements#iostreams.threadsafety)
|
||||
|
||||
### 31.2.4 Thread safety [iostreams.threadsafety]
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L138)
|
||||
|
||||
Concurrent access to a stream object ([[string.streams]](string.streams "31.8 String-based streams"), [[file.streams]](file.streams "31.10 File-based streams")), stream buffer
|
||||
object ([[stream.buffers]](stream.buffers "31.6 Stream buffers")), or C Library stream ([[c.files]](c.files "31.13 C library files")) by multiple threads may result in
|
||||
a data race ([[intro.multithread]](intro.multithread "6.10.2 Multi-threaded executions and data races")) unless otherwise specified ([[iostream.objects]](iostream.objects "31.4 Standard iostream objects"))[.](#1.sentence-1)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
Data races result in undefined behavior ([[intro.multithread]](intro.multithread "6.10.2 Multi-threaded executions and data races"))[.](#1.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L146)
|
||||
|
||||
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[.](#2.sentence-1)
|
||||
Reference in New Issue
Block a user