16 Library introduction [library]

16.5 Library-wide requirements [requirements]

16.5.4 Constraints on programs [constraints]

16.5.4.10 Library object access [res.on.objects]

The behavior of a program is undefined if calls to standard library functions from different threads may introduce a data race.
The conditions under which this may occur are specified in [res.on.data.races].
Note
:
Modifying an object of a standard library type that is shared between threads risks undefined behavior unless objects of that type are explicitly specified as being shareable without data races or the user supplies a locking mechanism.
— end note
 ]
If an object of a standard library type is accessed, and the beginning of the object's lifetime does not happen before the access, or the access does not happen before the end of the object's lifetime, the behavior is undefined unless otherwise specified.
Note
:
This applies even to objects such as mutexes intended for thread synchronization.
— end note
 ]