1 unstable release
Uses new Rust 2024
new 0.1.0 | May 10, 2025 |
---|
#415 in Concurrency
29KB
502 lines
Concurrent, lock-free, no-std
stack implementation in Rust.
- Uses atomic compare-and-exchange operations for thread safety
- Implements tagged pointers to prevent the ABA problem
- Each modification increments a tag counter to detect concurrent modifications
- Safe for concurrent access from multiple threads
Example
use unstacked::Stack;
let stack: Stack<i32> = Stack::new();
stack.push(1);
assert_eq!(stack.pop(), Some(1));
assert_eq!(stack.pop(), None);
stack.push(2);
assert_eq!(stack.peek(), Some(2).as_ref());
assert!(!stack.is_empty())