Skip to main content

Crate concurrent_sharded_stack

Crate concurrent_sharded_stack 

Source
Expand description

Sharded concurrent stacks for unordered object recycling.

ConcurrentShardedStack uses a lock-free Treiber stack and epoch GC. With the default intrusive feature, IntrusiveShardedStack uses embedded links and returns retired nodes for reuse after an epoch grace period. Both provide LIFO ordering within a shard, without global ordering.

§Example

use concurrent_sharded_stack::{ConcurrentShardedStack, PopError};

let stack = ConcurrentShardedStack::with_concurrency(4);
stack.push(1).unwrap();
stack.push(2).unwrap();

assert_eq!(stack.pop().unwrap(), 2);
assert_eq!(stack.pop().unwrap(), 1);
assert_eq!(stack.pop(), Err(PopError::Empty));

Re-exports§

pub use intrusive::ConcurrentLinkOps;
pub use intrusive::EpochAdapter;
pub use intrusive::IntrusiveShardedStack;
pub use intrusive::Retired;
pub use intrusive_collections;

Modules§

intrusive
Lock-free intrusive stacks and their epoch reclamation contracts.

Structs§

ConcurrentShardedStack
Concurrent sharded Treiber stack.

Enums§

PopError
PushError