Add a spin_loop_hint into debug_delay
@@ -20,6 +20,7 @@ pub fn pin() -> Guard {
pub fn debug_delay() {
#[cfg(any(test, feature = "lock_free_delays"))]
{
+ use std::sync::atomic::{spin_loop_hint, Ordering::SeqCst};
use std::thread;
use std::time::Duration;
@@ -34,6 +35,8 @@ pub fn debug_delay() {
thread::sleep(Duration::from_micros(duration as u64));
}
+ spin_loop_hint();
+
if thread_rng().gen::<bool>() {
thread::yield_now();
}
