The SharedTimedMutex
concept extends the TimedMutex
concept to include shared lock ownership mode.
Requirements
Additionally, for object m
of SharedTimedMutex
type supports timed shared operations:
- The expression
m.try_lock_shared_for(duration)
has the following properties- Behaves as an atomic operation.
- Attempts to obtain shared ownership of the mutex within the duration specified by
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. - If
try_lock_shared_for(duration)
succeeds, priorunlock()
operations on the same object synchronize-with this operation (equivalent to release-acquirestd::memory_order
). - The behavior is undefined if the calling thread already owns the mutex in any mode
- If an exception is thrown, the shared lock is not acquired.
- The expression
m.try_lock_shared_until(time_point)
has the following properties- Behaves as an atomic operation.
- Attempts to obtain shared ownership of the mutex within the time left until
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. - If
try_lock_shared_until(time_point)
succeeds, priorunlock()
operations on the same object synchronize-with this operation (equivalent to release-acquirestd::memory_order
). - The behavior is undefined if the calling thread already owns the mutex in any mode
- If an exception is thrown, the shared lock is not acquired.
Library types
The following standard library types satisfy SharedTimedMutex
:
Please login to continue.