Skip to content

Concurrent, lock-free, no-std stack implementation in Rust.

License

Notifications You must be signed in to change notification settings

cestef/unstacked

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

unstacked banner

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())

About

Concurrent, lock-free, no-std stack implementation in Rust.

Resources

License

Stars

Watchers

Forks

Languages