Implementation of a fast shared_recursive_mutex Thanks to https://github.com/KonanM/shared_recursive_mutex.
More...
#include <shared_recursive_mutex.h>
|
| | shared_recursive_mutex_t (const shared_recursive_mutex_t &)=delete |
| | Copying the mutex is not allowed. More...
|
| |
| shared_recursive_mutex_t & | operator= (const shared_recursive_mutex_t &)=delete |
| |
| void | lock () |
| | Locks the mutex for exclusive write access for this thread. Blocks execution as long as write access is not available: More...
|
| |
| void | lock_shared () |
| | Locks the mutex for sharable read access. Blocks execution as long as read access is not available: More...
|
| |
| void | unlock () |
| | Unlocks the mutex for this thread if its level of write ownership is 1 and has no read ownership. If the thread has write ownership of 1 and read ownership, the mutex will change from write to read access. Otherwise reduces the level of ownership by 1. More...
|
| |
| void | unlock_shared () |
| | Unlocks the mutex for this thread if its level of ownership is 1. Otherwise reduces the level of ownership by 1. More...
|
| |
| bool | try_lock () |
| | Tries to get write ownership if possible. If the thread has read (but no write) ownership this function returns false, because to upgrade a read lock to a write lock we have to give up read ownership, so if we can't aquire write ownership we have to reaquire the read ownership again, which might be a blocking operation. Use try_lock_upgrade is this is the wanted behavior. More...
|
| |
| bool | try_lock_shared () |
| | Tries to get read ownership if possible. More...
|
| |
| bool | is_locked () const |
| | Returns if this thread has write ownership. More...
|
| |
| bool | is_locked_shared () const |
| | Returns true if this thread has only read ownership. More...
|
| |
template<typename PhantomType>
class conscience_utils::mutexutils::shared_recursive_mutex_t< PhantomType >
Implementation of a fast shared_recursive_mutex Thanks to https://github.com/KonanM/shared_recursive_mutex.
◆ shared_recursive_mutex_t()
template<typename PhantomType >
Copying the mutex is not allowed.
◆ instance()
template<typename PhantomType >
◆ is_locked()
template<typename PhantomType >
Returns if this thread has write ownership.
◆ is_locked_shared()
template<typename PhantomType >
Returns true if this thread has only read ownership.
◆ lock()
template<typename PhantomType >
Locks the mutex for exclusive write access for this thread. Blocks execution as long as write access is not available:
- other thread has write access
- other threads try to get write access
- other threads have read access
A thread may call lock repeatedly. Ownership will only be released after the thread makes a matching number of calls to unlock.
◆ lock_shared()
template<typename PhantomType >
Locks the mutex for sharable read access. Blocks execution as long as read access is not available:
- other thread has write access
- other threads try to get write access
A thread may call lock repeatedly. If the thread already has write access the level of write access will be increased. Ownership will only be released after the thread makes a matching number of calls to unlock_shared.
◆ operator=()
template<typename PhantomType >
◆ try_lock()
template<typename PhantomType >
Tries to get write ownership if possible. If the thread has read (but no write) ownership this function returns false, because to upgrade a read lock to a write lock we have to give up read ownership, so if we can't aquire write ownership we have to reaquire the read ownership again, which might be a blocking operation. Use try_lock_upgrade is this is the wanted behavior.
◆ try_lock_shared()
template<typename PhantomType >
Tries to get read ownership if possible.
◆ unlock()
template<typename PhantomType >
Unlocks the mutex for this thread if its level of write ownership is 1 and has no read ownership. If the thread has write ownership of 1 and read ownership, the mutex will change from write to read access. Otherwise reduces the level of ownership by 1.
◆ unlock_shared()
template<typename PhantomType >
Unlocks the mutex for this thread if its level of ownership is 1. Otherwise reduces the level of ownership by 1.
The documentation for this class was generated from the following file: