Skip to main content

Module buf

Module buf 

Source
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.

Structs§

WordBuf
A capacity word followed by cap atomic 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.