|
EtcPal
HEAD (unstable)
ETC Platform Abstraction Layer (EtcPal)
|
View other versions:
|
An RAII handle holding a SynchronizedValue's lock and granting read-only access to the value.
The lock is acquired when the handle is constructed and released when it is destroyed. Handles are normally obtained from SynchronizedValue rather than constructed directly. Move-only.
| T | The type of the guarded value. |
| LockType | The type of lock guarding the value. |
Public Member Functions | |
| ConstStrictLockPtr (const SynchronizedValue< T, LockType > &sync) | |
| Lock the given SynchronizedValue for read-only access. More... | |
| ConstStrictLockPtr (const SynchronizedValue< T, LockType > &sync, AdoptLockTag) noexcept | |
| Adopt the given SynchronizedValue's lock, which the calling thread must already hold. | |
| ConstStrictLockPtr (ConstUniqueLockPtr< T, LockType > &&other) | |
Take over the lock held by other, which is left empty. More... | |
| ConstStrictLockPtr (const ConstStrictLockPtr &)=delete | |
| ConstStrictLockPtr & | operator= (const ConstStrictLockPtr &)=delete |
| ConstStrictLockPtr & | operator= (ConstStrictLockPtr &&)=delete |
| ConstStrictLockPtr (ConstStrictLockPtr &&other) noexcept | |
| Move ownership of the held lock from another handle, which is left empty. | |
| ~ConstStrictLockPtr () noexcept | |
| Release the lock. | |
| const T & | operator* () const noexcept |
| Get a reference to the guarded value. Undefined behavior if this handle has been moved from. | |
| const T * | operator-> () const noexcept |
| Access a member of the guarded value. Undefined behavior if this handle has been moved from. | |
Protected Attributes | |
| const SynchronizedValue< T, LockType > * | sync_ |
|
inlineexplicit |
Lock the given SynchronizedValue for read-only access.
| std::runtime_error | if lock could not be acquired. |
|
inlineexplicit |
Take over the lock held by other, which is left empty.
| std::runtime_error | if other does not own the lock. |