SharedMutex
C++ concepts: SharedMutex
The SharedMutex
concept extends the Mutex
concept to include shared lock ownership mode.
Requirements
Mutex
Additionally, for object m
of SharedMutex
type supports another m
ode of ownership: shared. Multiple threads (or, m
ore generally, execution agents) can sim
ulataneously own this m
utex in shared m
ode, but no thread m
ay obtain shared ownership if there is a thread that owns it in exclusive m
ode and no thread m
ay obtain exclusive ownership if there is a thread that owns it in shared m
ode. If m
ore than im
plem
entation-defined num
ber of threads (no less than 10000) hold a shared lock, another attem
pt to acquire the m
utex in shared m
ode blocks until the num
ber of shared owners drops down below that threshold.
- The expression
m.lock_shared()
has the following properties
Library types
The following standard library types satisfy SharedMutex
:
std::shared_mutex
(since C++17)
See also
- Thread support library
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.