Struct ThreadSafeFreelist::HeadPtr¶
Defined in File pool_allocator.hpp
Nested Relationships¶
This struct is a nested type of Class ThreadSafeFreelist.
Struct Documentation¶
-
struct
ripple::ThreadSafeFreelist
::
HeadPtr
¶ This struct is using a 32-bit offset into the freelist arena rather than a direct pointer, because together with the 32-bit tag, it needs to fit into 8 bytes to be atomic, which would not be the case if the offset was a pointer (even if the range of the tag was limited.
The tag is required so that there is no ABA problem where there is a pop in one thread, and a pop -> push in another, causing the new pushed head in the one thread to be in the same place as the popped head in the other, but with potentially different data. Updating the tag prevents this.
See the description in Node.