WRC
A thread-safe weighted reference counting smart-pointer for Rust.
Overview
By using weights instead of direct reference counting WRC requires roughly half as many synchronisation operations and writes to the heap. Every time a WRC is cloned it's weight is split in two, with half allocated to the parent and half allocated to the child. When a WRC is dropped it's weight is removed from the total. When the total weight declines to zero then the referenced object is dropped.
Features
- Thread-safe.
- Efficient.
- Lightweight.
Examples
Sharing some immutable data between threads:
use WRC;
use thread;
let five = WRCnew;
for _ in 0..10
Sharing a mutable AtomicUsize:
use WRC;
use ;
use thread;
let val = WRCnew;
for _ in 0..10
License
Source code is licensed under the terms of the MIT license, the text of which is included in the LICENSE file in this distribution.