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]
impl<T> LockFreeStack<T>
pub unsafe fn default_new_in_stack() -> LockFreeStack<T>
[src]
pub unsafe fn default_new_in_stack() -> LockFreeStack<T>
Return LockFreeStack in stack with default setting of HazardEpoch
pub fn default_new_in_heap() -> Box<Self>
[src]
pub fn default_new_in_heap() -> Box<Self>
Return LockFreeStack in heap with default setting of HazardEpoch
pub fn push(&mut self, v: T)
[src]
pub fn push(&mut self, v: T)
Push an element to the top of current stack
pub fn pop(&mut self) -> Option<T>
[src]
pub fn pop(&mut self) -> Option<T>
Pop the element at the top of current queue
pub unsafe fn destroy(&mut self)
[src]
pub unsafe fn destroy(&mut self)
Trait Implementations
impl<T> Drop for LockFreeStack<T>
[src]
impl<T> Drop for LockFreeStack<T>
Auto Trait Implementations
impl<T> !Send for LockFreeStack<T>
impl<T> !Send for LockFreeStack<T>
impl<T> !Sync for LockFreeStack<T>
impl<T> !Sync for LockFreeStack<T>