cs431_homework/elim_stack/
mod.rs1mod base;
4mod elim;
5mod treiber_stack;
6
7pub type ElimStack<T> = base::ElimStack<T, treiber_stack::TreiberStack<T>>;
9
10#[cfg(test)]
11mod test {
12 use std::thread::scope;
13
14 use base::Stack;
15
16 use super::*;
17
18 #[test]
19 fn push() {
20 let stack = ElimStack::default();
21
22 scope(|scope| {
23 let mut handles = Vec::new();
24 for _ in 0..10 {
25 let handle = scope.spawn(|| {
26 for i in 0..10_000 {
27 stack.push(i);
28 assert!(stack.pop().is_some());
29 }
30 });
31 handles.push(handle);
32 }
33 });
34
35 assert!(stack.pop().is_none());
36 }
37}