1 unstable release
Uses old Rust 2015
0.1.0 | Sep 10, 2016 |
---|
#85 in #push
6KB
151 lines
Original impetus: lock free stack for x86_64
lib.rs
:
Lock free stack for x86_64. Providing basic thread safe stack operations.
Examples
use concurrent_stack::ConcurrentStack;
use std::sync::Arc;
use std::thread;
let stack = Arc::new(ConcurrentStack::new());
let pusher = stack.clone();
let producer = thread::spawn(move || {
for i in 0..100 {
pusher.push(i);
}
});
let poper = stack.clone();
let consumer = thread::spawn(move || {
for _ in 0..100 {
if let Some(v) = poper.pop() {
// Deal with v.
}
}
});
producer.join();
consumer.join();
Dependencies
~10KB