An 8‐byte pointer with an integrated spin lock and 15‐bit integer.
Synopsis
Declared in <folly/PackedSyncPtr.h>
template<class T>
class PackedSyncPtr;
Description
This packs a raw pointer, a spin lock, and 15 bits of extra storage into a single 8‐byte word by reusing the always‐zero upper bytes of a 64‐bit virtual address. It is not a smart pointer: locking and deallocation are up to the user, and locks are only acquired or released through explicit lock() and unlock() calls.
Member Functions
Name |
Description |
Returns the extra data stored in the unused bytes of the pointer. |
|
Returns the stored raw pointer. |
|
Initializes a default‐constructed instance before first use. |
|
Acquires the integrated spin lock, blocking until it is held. |
|
Dereferences the stored raw pointer. |
|
Returns the stored raw pointer for member access. |
|
Accesses an element relative to the stored raw pointer. |
|
Sets a new raw pointer. |
|
Stores extra data in the unused bytes of the pointer. |
|
Attempts to acquire the integrated spin lock without blocking. |
|
Releases the integrated spin lock. |
Created with MrDocs