template <class InnerFields, class LockType>
class BaseLockedFieldsPtr
Defined at line 110 of file ../../third_party/cobalt/src/lib/util/protected_fields.h
BaseLockedFieldsPtr holds a pointer to Fields, as well a
unique_lock
<mutex
>.
Variables of this type are accessed using pointer syntax.
Implements:
- *BasicLockable*: This allows ProtectedFields objects to be used as the lock value in the wait
methods of std::condition_variable_any. (See:
https://en.cppreference.com/w/cpp/named_req/BasicLockable)
N.B. std::condition_variable may be more performant in some cases, and may
be preferred in performance critical situations. In those cases, raw
std::unique_lock
<std
::mutex> should be used.
Template types:
|InnerFields| is either the same as Fields above, or in the case of a ConstLockedFieldsPtr, it
is `const Fields`.
|LockType| The lock type to hold. (e.g. std::unique_lock
<std
::mutex>)
Public Methods
InnerFields * operator-> ()
Defined at line 112 of file ../../third_party/cobalt/src/lib/util/protected_fields.h
InnerFields & operator* ()
Defined at line 113 of file ../../third_party/cobalt/src/lib/util/protected_fields.h
void lock ()
Blocks until a lock can be obtained for the current execution agent (thread, process, task).
If an exception is thrown, no lock is obtained. Additionally, after the lock is obtained, the
inner fields become available again.
Defined at line 118 of file ../../third_party/cobalt/src/lib/util/protected_fields.h
void unlock ()
Releases the lock held by the execution agent. Throws no exceptions. Additionally, after the
lock is released, the inner fields are no longer accessible.
Requires: The current execution agent should hold the lock.
Defined at line 128 of file ../../third_party/cobalt/src/lib/util/protected_fields.h
void BaseLockedFieldsPtr<InnerFields, LockType> (BaseLockedFieldsPtr<InnerFields, LockType> && )
Disable copy/assign. Only allow move.
Defined at line 145 of file ../../third_party/cobalt/src/lib/util/protected_fields.h
BaseLockedFieldsPtr<InnerFields, LockType> & operator= (BaseLockedFieldsPtr<InnerFields, LockType> && )
Defined at line 146 of file ../../third_party/cobalt/src/lib/util/protected_fields.h
BaseLockedFieldsPtr<InnerFields, LockType> & operator= (const BaseLockedFieldsPtr<InnerFields, LockType> & )
Defined at line 147 of file ../../third_party/cobalt/src/lib/util/protected_fields.h
void BaseLockedFieldsPtr<InnerFields, LockType> (const BaseLockedFieldsPtr<InnerFields, LockType> & )
Defined at line 148 of file ../../third_party/cobalt/src/lib/util/protected_fields.h
Friends
template <class InnerFieldsclass LockType>
class BaseProtectedFields