Expand description
Arrays of atomic words for containers whose readers do not lock (lists, and dicts read
through their seqlock). Every slot is an AtomicU64, so a reader racing a writer sees some
value that was stored there, never a torn one. A writer that outgrows a buffer copies it into
a new one, publishes the new pointer with Release, and hands the old one to release,
which frees it only once no other thread can be reading it.
Written ranges. A buffer this module allocates is preceded by one more word: the range of
slots written since the owner’s last minor collection, which a minor collection of an old
container scans instead of every slot (issue #120). See WordBuf::note_written. Buffers
embedded in a container’s own object (WordBuf::init_in_place) have no such word.
Structs§
- WordBuf
- A capacity word followed by
capatomic slots.
Functions§
- release⚠
- Disposes of a buffer that was just replaced. With local access no other thread can be reading it, so it is freed now; otherwise the collector frees it at the next stop-the-world.