|
Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
|
RAII guard for exclusive (write) access. More...
#include <concurrency_utils.H>
Public Member Functions | |
| WriteLockedPtr (SharedMutex &mutex, T &value) | |
| Construct a guard and acquire an exclusive lock. | |
| WriteLockedPtr (WriteLockedPtr &&other) noexcept | |
| Take the lock and the access of another guard, which is left with neither. | |
| WriteLockedPtr & | operator= (WriteLockedPtr &&other) noexcept |
| Release the lock of this guard and take the lock and the access of another, which is left with neither. | |
| T & | get () noexcept |
| Access the protected value. | |
| T * | operator-> () noexcept |
| Access members of the protected value. | |
| T & | operator* () noexcept |
| Access the protected value. | |
Private Attributes | |
| std::unique_lock< SharedMutex > | lock_ |
| T * | ptr_ |
RAII guard for exclusive (write) access.
operator->() returns nullptr, and get() and operator*() must not be called on it (asserted in Debug builds). Definition at line 1083 of file concurrency_utils.H.
|
inline |
Construct a guard and acquire an exclusive lock.
| mutex | Shared mutex protecting the value. |
| value | Protected object to expose through the guard. |
| Any | exception thrown while locking mutex. |
Definition at line 1094 of file concurrency_utils.H.
|
inlinenoexcept |
Take the lock and the access of another guard, which is left with neither.
The implicit move took the lock but copied the pointer: the moved-from guard still gave the value, with no lock held.
| [in,out] | other | guard to move from. |
Definition at line 1105 of file concurrency_utils.H.
|
inlinenoexcept |
Access the protected value.
| Nothing. |
Definition at line 1126 of file concurrency_utils.H.
References Aleph::RwSynchronized< T, SharedMutex >::WriteLockedPtr::ptr_.
|
inlinenoexcept |
Access the protected value.
| Nothing. |
Definition at line 1142 of file concurrency_utils.H.
References Aleph::RwSynchronized< T, SharedMutex >::WriteLockedPtr::ptr_.
|
inlinenoexcept |
Access members of the protected value.
nullptr if the guard was moved from. | Nothing. |
Definition at line 1136 of file concurrency_utils.H.
References Aleph::RwSynchronized< T, SharedMutex >::WriteLockedPtr::ptr_.
|
inlinenoexcept |
Release the lock of this guard and take the lock and the access of another, which is left with neither.
| [in,out] | other | guard to move from. |
Definition at line 1113 of file concurrency_utils.H.
References Aleph::RwSynchronized< T, SharedMutex >::WriteLockedPtr::lock_, and Aleph::RwSynchronized< T, SharedMutex >::WriteLockedPtr::ptr_.
|
private |
Definition at line 1085 of file concurrency_utils.H.
Referenced by Aleph::RwSynchronized< T, SharedMutex >::WriteLockedPtr::operator=().
|
private |
Definition at line 1086 of file concurrency_utils.H.
Referenced by Aleph::RwSynchronized< T, SharedMutex >::WriteLockedPtr::get(), Aleph::RwSynchronized< T, SharedMutex >::WriteLockedPtr::operator*(), Aleph::RwSynchronized< T, SharedMutex >::WriteLockedPtr::operator->(), and Aleph::RwSynchronized< T, SharedMutex >::WriteLockedPtr::operator=().