Skip to content

Commit

Permalink
Suppress deprecated warnings for spin_loop_hint (#3497)
Browse files Browse the repository at this point in the history
* Suppress deprecated warnings for spin_loop_hint

* Update tokio/src/loom/std/mod.rs

Co-authored-by: Taiki Endo <te316e89@gmail.com>

* Update tokio/src/sync/task/atomic_waker.rs

Co-authored-by: Taiki Endo <te316e89@gmail.com>

* fmt

Co-authored-by: Taiki Endo <te316e89@gmail.com>
  • Loading branch information
vorot93 and taiki-e committed Feb 1, 2021
1 parent 60d8884 commit cc97fb8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tokio/src/loom/std/mod.rs
Expand Up @@ -74,7 +74,10 @@ pub(crate) mod sync {
pub(crate) use crate::loom::std::atomic_u8::AtomicU8;
pub(crate) use crate::loom::std::atomic_usize::AtomicUsize;

pub(crate) use std::sync::atomic::{fence, spin_loop_hint, AtomicBool, Ordering};
pub(crate) use std::sync::atomic::{fence, AtomicBool, Ordering};
// TODO: once we bump MSRV to 1.49+, use `hint::spin_loop` instead.
#[allow(deprecated)]
pub(crate) use std::sync::atomic::spin_loop_hint;
}
}

Expand Down
2 changes: 2 additions & 0 deletions tokio/src/sync/task/atomic_waker.rs
Expand Up @@ -223,6 +223,8 @@ impl AtomicWaker {
waker.wake();

// This is equivalent to a spin lock, so use a spin hint.
// TODO: once we bump MSRV to 1.49+, use `hint::spin_loop` instead.
#[allow(deprecated)]
atomic::spin_loop_hint();
}
state => {
Expand Down

0 comments on commit cc97fb8

Please sign in to comment.