mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-05 18:20:34 +00:00
cros_async: switch to std::hint::spin_loop
Replace the deprecated std::sync::spin_loop_hint with std::hint::spin_loop. Fixes this new warning from Rust 1.51: warning: use of deprecated function `std::sync::atomic::spin_loop_hint`: use hint::spin_loop instead BUG=None TEST=bin/clippy Change-Id: Ic975c77ea19bcf256f73c0b3b89f85866abfe0bb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2864362 Reviewed-by: Zach Reizner <zachr@chromium.org> Reviewed-by: Dylan Reid <dgreid@chromium.org> Tested-by: Daniel Verkamp <dverkamp@chromium.org> Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
This commit is contained in:
parent
548754cd2f
commit
9901c7509c
3 changed files with 14 additions and 11 deletions
|
@ -3,8 +3,9 @@
|
|||
// found in the LICENSE file.
|
||||
|
||||
use std::cell::UnsafeCell;
|
||||
use std::hint;
|
||||
use std::mem;
|
||||
use std::sync::atomic::{spin_loop_hint, AtomicUsize, Ordering};
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::sync::mu::{MutexGuard, MutexReadGuard, RawMutex};
|
||||
|
@ -171,7 +172,7 @@ impl Condvar {
|
|||
)
|
||||
.is_err()
|
||||
{
|
||||
spin_loop_hint();
|
||||
hint::spin_loop();
|
||||
oldstate = self.state.load(Ordering::Relaxed);
|
||||
}
|
||||
|
||||
|
@ -223,7 +224,7 @@ impl Condvar {
|
|||
)
|
||||
.is_err()
|
||||
{
|
||||
spin_loop_hint();
|
||||
hint::spin_loop();
|
||||
oldstate = self.state.load(Ordering::Relaxed);
|
||||
}
|
||||
|
||||
|
@ -281,7 +282,7 @@ impl Condvar {
|
|||
)
|
||||
.is_err()
|
||||
{
|
||||
spin_loop_hint();
|
||||
hint::spin_loop();
|
||||
oldstate = self.state.load(Ordering::Relaxed);
|
||||
}
|
||||
|
||||
|
@ -319,7 +320,7 @@ impl Condvar {
|
|||
)
|
||||
.is_err()
|
||||
{
|
||||
spin_loop_hint();
|
||||
hint::spin_loop();
|
||||
oldstate = self.state.load(Ordering::Relaxed);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,9 +3,10 @@
|
|||
// found in the LICENSE file.
|
||||
|
||||
use std::cell::UnsafeCell;
|
||||
use std::hint;
|
||||
use std::mem;
|
||||
use std::ops::{Deref, DerefMut};
|
||||
use std::sync::atomic::{spin_loop_hint, AtomicUsize, Ordering};
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
use std::sync::Arc;
|
||||
use std::thread::yield_now;
|
||||
|
||||
|
@ -182,7 +183,7 @@ fn get_wake_list(waiters: &mut WaiterList) -> (WaiterList, usize) {
|
|||
#[inline]
|
||||
fn cpu_relax(iterations: usize) {
|
||||
for _ in 0..iterations {
|
||||
spin_loop_hint();
|
||||
hint::spin_loop();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -518,7 +519,7 @@ impl RawMutex {
|
|||
)
|
||||
.is_err()
|
||||
{
|
||||
spin_loop_hint();
|
||||
hint::spin_loop();
|
||||
oldstate = self.state.load(Ordering::Relaxed);
|
||||
}
|
||||
|
||||
|
@ -593,7 +594,7 @@ impl RawMutex {
|
|||
)
|
||||
.is_err()
|
||||
{
|
||||
spin_loop_hint();
|
||||
hint::spin_loop();
|
||||
oldstate = self.state.load(Ordering::Relaxed);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,8 +3,9 @@
|
|||
// found in the LICENSE file.
|
||||
|
||||
use std::cell::UnsafeCell;
|
||||
use std::hint;
|
||||
use std::ops::{Deref, DerefMut};
|
||||
use std::sync::atomic::{spin_loop_hint, AtomicBool, Ordering};
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
|
||||
const UNLOCKED: bool = false;
|
||||
const LOCKED: bool = true;
|
||||
|
@ -64,7 +65,7 @@ impl<T: ?Sized> SpinLock<T> {
|
|||
{
|
||||
break;
|
||||
}
|
||||
spin_loop_hint();
|
||||
hint::spin_loop();
|
||||
}
|
||||
|
||||
SpinLockGuard {
|
||||
|
|
Loading…
Reference in a new issue