|
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
TheMutex requirements extends theLockable requirements to include inter-thread synchronization.
Contents |
For an objectm ofMutex type:
try_lock() succeeds, priorunlock() operations on the same objectsynchronize-with this operation (equivalent to release-acquirestd::memory_order).lock() does not synchronize with a failedtry_lock().The following standard library types satisfyMutex requirements:
(C++11) | provides basic mutual exclusion facility (class)[edit] |
(C++11) | provides mutual exclusion facility which can be locked recursively by the same thread (class)[edit] |
(C++11) | provides mutual exclusion facility which can be locked recursively by the same thread and implements locking with a timeout (class)[edit] |
(C++17) | provides shared mutual exclusion facility (class)[edit] |
(C++14) | provides shared mutual exclusion facility and implements locking with a timeout (class)[edit] |
(C++11) | provides mutual exclusion facility which implements locking with a timeout (class)[edit] |
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
| DR | Applied to | Behavior as published | Correct behavior |
|---|---|---|---|
| LWG 2309 | C++11 | lock might throwstd::system_errorwith error codestd::errc::device_or_resource_busy | not allowed |