|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Member functions | ||||
| Exclusive locking | ||||
| Shared locking | ||||
shared_timed_mutex::lock_shared | ||||
void lock_shared(); | (since C++14) | |
Acquires shared ownership of the mutex. If another thread is holding the mutex in exclusive ownership, a call tolock_shared will block execution until shared ownership can be acquired.
Iflock_shared is called by a thread that already owns themutex in any mode (exclusive or shared), the behavior is undefined.
If more than the implementation-defined maximum number of shared owners already locked the mutex in shared mode,lock_shared blocks execution until the number of shared owners is reduced. The maximum number of owners is guaranteed to be at least 10000.
Priorunlock() operation on the same mutexsynchronizes-with (as defined instd::memory_order) this operation.
Contents |
(none)
(none)
Throwsstd::system_error when errors occur, including errors from the underlying operating system that would preventlock from meeting its specifications. The mutex is not locked in the case of any exception being thrown.
lock_shared() is usually not called directly:std::shared_lock is used to manage shared locking.
| This section is incomplete Reason: no example |
| locks the mutex, blocks if the mutex is not available (public member function)[edit] | |
| tries to lock the mutex for shared ownership, returns if the mutex is not available (public member function)[edit] | |
| unlocks the mutex (shared ownership) (public member function)[edit] |