C++ named requirements: SharedLockable (since C++14)
From cppreference.com
C++
Feature test macros (C++20)
Concepts library (C++20)
Metaprogramming library (C++11)
Ranges library (C++20)
Filesystem library (C++17)
Concurrency support library (C++11)
Execution control library (C++26)
C++ named requirements
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++17)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++17)
(C++20)
(C++20)
(C++20)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
SharedLockable
(C++14)
(C++14)
(C++11)
(C++11)
(C++17)
(C++14)
(C++20)
(C++20)
(C++23)
(C++23)
(C++23)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
The SharedLockable requirements describe the minimal characteristics of types that provide shared blocking semantics for execution agents (i.e. threads).
[edit] Requirements
For type L
to be SharedLockable, the following conditions have to be satisfied for an object m
of type L
:
Expression | Preconditions | Effects | Return value |
---|---|---|---|
m.lock_shared() | Blocks until a lock can be obtained for the current execution agent (thread, process, task). If an exception is thrown, no lock is obtained. | ||
m.try_lock_shared() | Attempts to obtain a lock for the current execution agent (thread, process, task) without blocking. If an exception is thrown, no lock is obtained. | true if the lock was obtained, false otherwise | |
m.unlock_shared() | The current execution agent holds a shared lock on m .
|
Releases the shared lock held by the execution agent.
Throws no exceptions. |
[edit]
A lock on an object is said to be shared lock if it is acquired by a call to lock_shared
, try_lock_shared
, try_lock_shared_for
, or try_lock_shared_until
member function.
[edit] Standard library
The following standard library types satisfy SharedLockable requirements:
(C++14)
(class) [edit]