Skip to content

Commit

Permalink
Replace deprecated spin_loop_hint.
Browse files Browse the repository at this point in the history
sled requires Rust 1.62+ and `spin_loop` is availabe starting
in 1.42.
  • Loading branch information
ttsugriy committed Sep 4, 2023
1 parent 005c023 commit eba02e8
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/backoff.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/// Vendored and simplified from crossbeam-utils
use core::cell::Cell;
use core::sync::atomic;

const SPIN_LIMIT: u32 = 6;

Expand Down Expand Up @@ -31,9 +30,7 @@ impl Backoff {
#[inline]
pub fn spin(&self) {
for _ in 0..1 << self.step.get().min(SPIN_LIMIT) {
// `hint::spin_loop` requires Rust 1.49.
#[allow(deprecated)]
atomic::spin_loop_hint();
core::hint::spin_loop();
}

if self.step.get() <= SPIN_LIMIT {
Expand Down

0 comments on commit eba02e8

Please sign in to comment.