|
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
TheSharedTimedMutex requirements extend theTimedMutex requirements to include shared lock ownership mode.
Additionally, an objectm ofSharedTimedMutex type supports timed shared operations:
duration. Ifduration is less or equalduration.zero(), attempts to obtain the ownership without waiting (as if bytry_lock()). Otherwise, this function blocks until the mutex is acquired or until the time specified byduration passes. It returns withinduration only if it succeeds, but it allowed to fail to acquire the mutex even if at some point in time duringduration it was not owned by another thread. In any case, it returnstrue if the mutex was acquired andfalse otherwise.try_lock_shared_for(duration) succeeds, priorunlock() operations on the same objectsynchronize-with this operation (equivalent to release-acquirestd::memory_order).time_point. Iftime_point already passed, attempts to obtain the ownership without locking (as if bytry_lock()). Otherwise, this function blocks until the mutex is acquired or until the time specified bytime_point passes. It returns beforetime_point only if it succeeds, but it allowed to fail to acquire the mutex even if at some point in time beforetime_point it was not owned by another thread. In any case, it returnstrue if the mutex was acquired andfalse otherwise.try_lock_shared_until(time_point) succeeds, priorunlock() operations on the same objectsynchronize-with this operation (equivalent to release-acquirestd::memory_order).The following standard library types satisfySharedTimedMutex requirements:
(C++14) | provides shared mutual exclusion facility and implements locking with a timeout (class)[edit] |