tagged free-list head using a 128-bit (pointer, version) pair More...
#include <taskflow/utility/object_pool.hpp>
Public Types | |
| using | pointer_type = uintptr_t |
| block address representation | |
| using | tag_type = uintptr_t |
| ABA version counter representation. | |
Public Member Functions | |
| TaggedHead128 ()=default | |
| constructs a null, zero-tagged head | |
| TaggedHead128 (pointer_type p, tag_type t) noexcept | |
| constructs a head with an explicit block address and version counter | |
| pointer_type | get_ptr () const noexcept |
| returns the stored block address | |
| tag_type | get_tag () const noexcept |
| returns the ABA version counter | |
Public Attributes | |
| pointer_type | ptr {0} |
block address (reinterpret-cast to/from ObjectBlock*) | |
| tag_type | tag {0} |
| ABA version counter; incremented on every push and pop. | |
tagged free-list head using a 128-bit (pointer, version) pair
TaggedHead128 stores the free-list head pointer and an ABA version counter as two independent 64-bit words, yielding a 16-byte representation. std::atomic<TaggedHead128> requires a 128-bit compare-and-swap: CMPXCHG16B on x86-64 or CASP on ARMv8.1+. On platforms that lack a native 128-bit CAS (e.g. RISC-V, baseline ARMv8.0), the atomic falls back to a lock-based implementation — still correct, but no longer lock-free.
The full 64-bit version counter makes ABA wrap-around effectively impossible under any realistic workload.
|
inlinenoexcept |
constructs a head with an explicit block address and version counter
| p | block address as uintptr_t |
| t | ABA version counter |