Crate rs_lockfree[][src]

Lock-Free lib based on practical Hazard Pointers algorithm for Rust

Hazard Pointers algorithm firstly saves the pointer of shared object to local thread, and then accessed it, and removes it after accessing is over. An object can be released only when there is no thread contains its reference, which solve the ABA problem.

Theoretically, Hazard Pointers resolve the performance bottleneck problem causing by atomic reference counting, but also has some Inadequacies: It costs lot of time to traverse global array when reclaiming memory; Traversing global array doesn't guarantee atomicity; Each shared object should maintain relationships with all threads, which increases the cost of usage.

We provide HazardEpoch, a practical implementation of Hazard Pointers, which make further improvement and provide an easier way for usage. LockFreeQueue and LockFreeStack, implemented based on HazardEpoch, contain a few simple methods like push, pop.



Definition of error and status.


Definition and implementations of of HazardEpoch


Definition and implementations of LockFreeQueue


Definition and implementations of LockFreeStack


Definition and implementations of SpinLock


Definition and implementations of SpinRWLock


Utility of project