A LockedPtr keeps a Synchronized<T> object locked for the duration of LockedPtr's existence.
Declared in <folly/Synchronized.h>
template<
class LockedType,
class LockPolicy>
class LockedPtr;
It provides access the datum's members directly by using operator->() and operator*().
The LockPolicy parameter controls whether or not the lock is acquired in exclusive or shared mode.
| Name | Description |
|---|---|
DataType | The type of the guarded datum. |
LockType | The underlying lock type held by this pointer. |
MutexType | The type of the mutex guarding the datum. |
Synchronized | The non-const Synchronized type this pointer locks. |
| Name | Description |
|---|---|
LockedPtr [constructor] | Constructors |
~LockedPtr [destructor] | Destructor releases. |
operator= | Assignment operators |
asNonConstUnsafe | Locks that allow concurrent access (shared, upgrade) force const access with the standard accessors even if the Synchronized object is non-const. |
as_lock | as_lock overloads |
isNull | Check if this LockedPtr is uninitialized, or points to valid locked data. |
moveFromUpgradeToRead | Move the locked ptr from an upgrade state to a shared state. The current lock is left in a null state. |
moveFromUpgradeToWrite | * Upgrade lock methods. These are disabled via SFINAE when the mutex is not an upgrade mutex. |
moveFromWriteToRead | Move the locked ptr from an exclusive state to a shared state. The current lock is left in a null state. |
moveFromWriteToUpgrade | Move the locked ptr from an exclusive state to an upgrade state. The current lock is left in a null state. |
operator* | Access the locked data. |
operator-> | Access the locked data. |
parent | Recover the parent Synchronized object from the held lock. |
scopedUnlock | Temporarily unlock the LockedPtr, and reset it to null. |
unlock | Release the lock and reset this pointer to null. |
operator bool | Explicit boolean conversion. |
| Name | Description |
|---|---|
folly::ScopedUnlocker | This class temporarily unlocks a LockedPtr in a scoped manner. |
folly::LockedPtr | A LockedPtr keeps a Synchronized<T> object locked for the duration of LockedPtr's existence. |