2 Check for empty spin loops
5 The loop body should have something like `thread::park()` or at least
6 `std::hint::spin_loop()` to avoid needlessly burning cycles and conserve
7 energy. Perhaps even better use an actual lock, if possible.
10 This lint doesn't currently trigger on `while let` or
11 `loop { match .. { .. } }` loops, which would be considered idiomatic in
12 combination with e.g. `AtomicBool::compare_exchange_weak`.
17 use core::sync::atomic::{AtomicBool, Ordering};
18 let b = AtomicBool::new(true);
19 // give a ref to `b` to another thread,wait for it to become false
20 while b.load(Ordering::Acquire) {};
24 while b.load(Ordering::Acquire) {
25 std::hint::spin_loop()