https://github.com/cestef/unstacked
Concurrent, lock-free, no-std stack implementation in Rust.
https://github.com/cestef/unstacked
Last synced: 4 months ago
JSON representation
Concurrent, lock-free, no-std stack implementation in Rust.
- Host: GitHub
- URL: https://github.com/cestef/unstacked
- Owner: cestef
- License: mit
- Created: 2025-05-09T13:10:42.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-08-19T10:11:06.000Z (10 months ago)
- Last Synced: 2025-09-21T22:51:38.713Z (9 months ago)
- Language: Rust
- Homepage:
- Size: 20.5 KB
- Stars: 11
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
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](https://en.wikipedia.org/wiki/ABA_problem)
- Each modification increments a tag counter to detect concurrent modifications
- Safe for concurrent access from multiple threads
## Example
```rust
use unstacked::Stack;
let stack: Stack = 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())
```