In order to meet the requirements of the SharedLockable
concept, a type must
meet the TimedLockable
requirements. In addition, it must also support lock_shared()
, unlock_shared()
, try_lock_shared()
, try_lock_shared_for()
and try_lock_shared_until()
member functions with the following signatures
and semantics:
struct shared-lockable-type { // required by the TimedLockable concept void lock(); void unlock(); bool try_lock(); template<typename Rep,typename Period> bool try_lock_for( std::chrono::duration<Rep,Period> const& relative_time); template<typename Clock,typename Duration> bool try_lock_until( std::chrono::time_point<Clock,Duration> const& absolute_time); // additional functions required by the SharedLockable concept void lock_shared(); void unlock_shared(); bool try_lock_shared(); template<typename Rep,typename Period> bool try_lock_shared_for( std::chrono::duration<Rep,Period> const& relative_time); template<typename Clock_shared,typename Duration> bool try_lock_shared_until( std::chrono::time_point<Clock_shared,Duration> const& absolute_time); };
lock_shared()
Requirements
For an instance m
of a SharedLockable
type, the expression m.lock_shared()
shall block until a shared-ownership lock
can be acquired for the current thread.
try_lock_shared()
Requirements
For an instance m
of a SharedLockable
type, the expression m.try_lock_shared()
shall attempt to acquire a shared-ownership
lock for the current thread without blocking. The function shall return
true
if the lock was acquired,
false
otherwise.
unlock_shared()
Requirements
For an instance m
of a SharedLockable
type, the expression m.unlock_shared()
shall release a shared-ownership lock held
by the current thread, previously acquired by a call to m.lock_shared()
, m.try_lock_shared()
, m.try_lock_shared_for()
or m.try_lock_shared_until()
.
try_lock_shared_for()
Requirements
For an instance m
of a SharedLockable
type and a value relative_time
of an instantiation of the
std::chrono::duration
class template, the expression m.try_lock_shared_for(relative_time)
shall attempt to acquire a shared-ownership
lock for the current thread of execution within the specified time period.
The function shall return true
if the lock was acquired, false
otherwise. The elapsed time for the duration shall be measured with a steady
clock where possible.
try_lock_shared_until()
Requirements
For an instance m
of a SharedLockable
type and a value absolute_time
of an instantiation of the
std::chrono::time_point
class template, the expression m.try_lock_shared_until(absolute_time)
shall attempt to acquire a shared-ownership
lock for the current thread of execution before the specified time. The function
shall return true
if the lock
was acquired, false
otherwise.