Add spin_loop_hint in `register` spinlock
This commit is contained in:
parent
4356b64717
commit
107bfe5bad
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
use std::cell::UnsafeCell;
|
use std::cell::UnsafeCell;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::sync::atomic::AtomicUsize;
|
use std::sync::atomic::{self, AtomicUsize};
|
||||||
use std::sync::atomic::Ordering::{Acquire, Release, AcqRel};
|
use std::sync::atomic::Ordering::{Acquire, Release, AcqRel};
|
||||||
use std::task::Waker;
|
use std::task::Waker;
|
||||||
|
|
||||||
|
@ -330,6 +330,9 @@ impl AtomicWaker {
|
||||||
// could also spin here trying to acquire the lock
|
// could also spin here trying to acquire the lock
|
||||||
// to register).
|
// to register).
|
||||||
waker.wake_by_ref();
|
waker.wake_by_ref();
|
||||||
|
|
||||||
|
// This is equivalent to a spin lock, so use a spin hint.
|
||||||
|
atomic::spin_loop_hint();
|
||||||
}
|
}
|
||||||
state => {
|
state => {
|
||||||
// In this case, a concurrent thread is holding the
|
// In this case, a concurrent thread is holding the
|
||||||
|
|
Loading…
Reference in New Issue