Crate atomic_lifo

Crate atomic_lifo 

Source
Expand description

§jni-simple

§atomic lifo

Lock free thread-safe lifo for rust.

§Example

use std::thread;
use atomic_lifo::AtomicLifo;

static MT_LIFO: AtomicLifo<u32> = AtomicLifo::new();

pub fn example() {
    MT_LIFO.push(456);
    MT_LIFO.push(123);
    let th = {
        thread::spawn(move || {
            assert_eq!(MT_LIFO.pop(), Some(123));
            assert_eq!(MT_LIFO.pop(), Some(456));
            assert_eq!(MT_LIFO.pop(), None);
        })
    };

    th.join().unwrap();
}

Structs§

AtomicLifo
Thread Safe LIFO Stack/Single linked list.