Struct rs_lockfree::lockfree_stack::LockFreeStack[][src]

pub struct LockFreeStack<T> { /* fields omitted */ }

LockFree stack, implemented based on HazardEpoch

Examples

use rs_lockfree::lockfree_stack::LockFreeStack;
let mut stack = unsafe { LockFreeStack::default_new_in_stack() };
assert!(stack.pop().is_none());
stack.push(1);
assert_eq!(stack.pop().unwrap(), 1);
let test_num = 100;
for i in 0..test_num {
    stack.push(i);
}
for i in 0..test_num {
    assert_eq!(stack.pop().unwrap(), test_num - i - 1);
}

Methods

impl<T> LockFreeStack<T>
[src]

Return LockFreeStack in stack with default setting of HazardEpoch

Return LockFreeStack in heap with default setting of HazardEpoch

Push an element to the top of current stack

Pop the element at the top of current queue

Trait Implementations

impl<T> Drop for LockFreeStack<T>
[src]

Executes the destructor for this type. Read more

Auto Trait Implementations

impl<T> !Send for LockFreeStack<T>

impl<T> !Sync for LockFreeStack<T>