Crate atomic_try_update
source ·Expand description
Primitives that make it easy to implement correct lock-free algorithms
atomic_try_update is the main entry-point to this library, but (with
the exception of NonceStack) the included example code is also designed
to be used in production. Each module implements a different family of
example algorithms. If you simply want to use general-purpose algorithms
without modification, start with the public APIs of the data structures
in those modules.
If you want to start implementing your own specialized lock-free logic, start with this page, then read the top-level descriptions of each of the modules this crate exports.
Modules
- Bit packing and pointer alignment utilities that make it easier to fit additional state into an
Atom<T> - Examples of the claim mutual exclusion pattern, including an example of the claim_queue, which allows multiple workers to enqueue work and ensures that exactly one worker running if there is work to be done.
- Lightweight lock-free stack implementations
Structs
- A wrapper that allows an instance of type T to be treated as though it is an atomic integer type (in the style of a C/C++ union). Use
atomic_try_updateto access the data of typeTstored in anAtom<T>. - A linked list node that contains an instance of type T and a raw pointer to the next entry in the node. Since
atomic_try_updatespeculatively executes code, it can not handle values ofBox<T>soundly. Therefore, this is the idiomatic way to store linked lists and stacks withatomic_try_update. - A consuming iterator over a value of type Node.
Functions
- This function is used to implement lock free synchronization primitives.