mCRL2
|
#include <shared_mutex.h>
Public Member Functions | |
shared_mutex () | |
~shared_mutex () | |
shared_mutex (const shared_mutex &other) | |
The copy/move constructor/assignment should not be called while any lock_guard or shared_guard is alive. | |
shared_mutex (shared_mutex &&other) | |
shared_mutex & | operator= (const shared_mutex &other) |
shared_mutex & | operator= (shared_mutex &&other) |
lock_guard | lock () |
void | unlock () |
shared_guard | lock_shared () |
bool | is_shared_locked () const |
Private Member Functions | |
void | unlock_impl () |
void | lock_shared_impl () |
void | unlock_shared () |
bool | is_busy () const |
void | wait_for_busy () const |
Waits for the busy flag to become false. | |
void | set_forbidden (bool value) |
Private Attributes | |
std::atomic< bool > | m_busy_flag = false |
A boolean flag indicating whether this thread is working inside the global aterm pool. | |
std::atomic< bool > | m_forbidden_flag = false |
std::size_t | m_lock_depth = 0 |
It can happen that un/lock_shared calls are nested, so keep track of the nesting depth and only actually perform un/locking at the root. | |
std::shared_ptr< shared_mutex_data > | m_shared |
Friends | |
class | lock_guard |
class | shared_guard |
class | shared_mutex_pool |
An implementation of a shared mutex (also called readers-write lock in the literature) based on the notion of busy and forbidden flags.
Definition at line 117 of file shared_mutex.h.
|
inline |
Definition at line 120 of file shared_mutex.h.
|
inline |
Definition at line 126 of file shared_mutex.h.
|
inline |
The copy/move constructor/assignment should not be called while any lock_guard or shared_guard is alive.
Definition at line 132 of file shared_mutex.h.
|
inline |
Definition at line 138 of file shared_mutex.h.
|
inlineprivate |
Definition at line 287 of file shared_mutex.h.
|
inline |
Definition at line 224 of file shared_mutex.h.
|
inline |
Definition at line 173 of file shared_mutex.h.
|
inline |
Acquires a shared lock on this instance, returns a shared guard that keeps the lock until it is destroyed. Or alternative, unlock_shared is called explicitly.
Definition at line 217 of file shared_mutex.h.
|
inlineprivate |
Definition at line 248 of file shared_mutex.h.
|
inline |
Definition at line 145 of file shared_mutex.h.
|
inline |
Definition at line 158 of file shared_mutex.h.
|
inlineprivate |
Definition at line 300 of file shared_mutex.h.
|
inline |
Definition at line 209 of file shared_mutex.h.
|
inlineprivate |
Definition at line 234 of file shared_mutex.h.
|
inlineprivate |
Definition at line 273 of file shared_mutex.h.
|
inlineprivate |
Waits for the busy flag to become false.
Definition at line 294 of file shared_mutex.h.
|
friend |
Definition at line 230 of file shared_mutex.h.
|
friend |
Definition at line 231 of file shared_mutex.h.
|
friend |
Definition at line 232 of file shared_mutex.h.
|
private |
A boolean flag indicating whether this thread is working inside the global aterm pool.
Definition at line 306 of file shared_mutex.h.
|
private |
Definition at line 307 of file shared_mutex.h.
|
private |
It can happen that un/lock_shared calls are nested, so keep track of the nesting depth and only actually perform un/locking at the root.
Definition at line 311 of file shared_mutex.h.
|
private |
Definition at line 313 of file shared_mutex.h.