[thread.req.lockable.shared.timed] (original) (raw)

32 Concurrency support library [thread]

32.2 Requirements [thread.req]

32.2.5 Requirements for Cpp17Lockable types [thread.req.lockable]

32.2.5.6 Cpp17SharedTimedLockable requirements [thread.req.lockable.shared.timed]

A type L meets the Cpp17SharedTimedLockable requirements if it meets the Cpp17SharedLockable requirements, and the following expressions are well-formed, have type bool, and have the specified semantics (m denotes a value of type L,rel_time denotes a value of a specialization of chrono​::​duration, andabs_time denotes a value of a specialization of chrono​::​time_point).

m.try_lock_shared_for(rel_time)

Effects: Attempts to acquire a lock for the current execution agent within the relative timeout ([thread.req.timing]) specified by rel_time.

The function will not return within the timeout specified by rel_timeunless it has obtained a lock on m for the current execution agent.

If an exception is thrown then a lock has not been acquired for the current execution agent.

Returns: true if the lock was acquired, false otherwise.

m.try_lock_shared_until(abs_time)

Effects: Attempts to acquire a lock for the current execution agent before the absolute timeout ([thread.req.timing]) specified by abs_time.

The function will not return before the timeout specified by abs_timeunless it has obtained a lock on m for the current execution agent.

If an exception is thrown then a lock has not been acquired for the current execution agent.

Returns: true if the lock was acquired, false otherwise.