diff --git a/benches/two_threads.rs b/benches/two_threads.rs index 8e35c55..e8dbe6f 100644 --- a/benches/two_threads.rs +++ b/benches/two_threads.rs @@ -73,7 +73,9 @@ pub fn add_function( std::thread::spawn(move || { barrier.wait(); for _ in 0..iters { - while !push(&mut p, black_box(42)) {} + while !push(&mut p, black_box(42)) { + std::hint::spin_loop(); + } } barrier.wait(); }) @@ -81,7 +83,9 @@ pub fn add_function( barrier.wait(); let start = std::time::Instant::now(); for _ in 0..iters { - while pop(&mut c).is_none() {} + while pop(&mut c).is_none() { + std::hint::spin_loop(); + } } barrier.wait(); let duration = start.elapsed();