|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Member functions | ||||
| Exclusive locking | ||||
| Shared locking | ||||
shared_mutex::try_lock_shared | ||||
| Native handle | ||||
bool try_lock_shared(); | (since C++17) | |
Tries to lock the mutex in shared mode. Returns immediately. On successful lock acquisition returnstrue, otherwise returnsfalse.
This function is allowed to fail spuriously and returnfalse even if the mutex is not currenly exclusively locked by any other thread.
A priorunlock() operation on the same mutexsynchronizes-with (as defined instd::memory_order) this operation if it returnstrue.
The behavior is undefined if the calling thread already owns the mutex in any mode.
Contents |
(none)
true if the lock was acquired successfully, otherwisefalse.
Throws nothing.
| 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, returns if the mutex is not available (public member function)[edit] | |
| unlocks the mutex (shared ownership) (public member function)[edit] |