Skip to content

Commit 4d64bc6

Browse files
authored
Merge pull request #314 from Amanieu/spin_loop
2 parents b3c9290 + a4e4a02 commit 4d64bc6

File tree

4 files changed

+13
-12
lines changed

4 files changed

+13
-12
lines changed

.github/workflows/rust.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ name: Rust
22

33
on:
44
push:
5-
branches-ignore:
6-
- trying.tmp
7-
- staging.tmp
5+
branches:
6+
- trying
7+
- staging
88
pull_request:
9-
9+
1010
env:
1111
RUST_TEST_THREADS: 1
1212

@@ -16,11 +16,11 @@ jobs:
1616
strategy:
1717
matrix:
1818
os: [ubuntu, macos, windows]
19-
channel: [1.41.0, stable, beta, nightly]
19+
channel: [1.49.0, stable, beta, nightly]
2020
feature: [arc_lock, serde, deadlock_detection]
2121
exclude:
2222
- feature: deadlock_detection
23-
channel: '1.41.0'
23+
channel: '1.49.0'
2424
include:
2525
- channel: nightly
2626
feature: nightly

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ changes to the core API do not cause breaking changes for users of `parking_lot`
135135

136136
## Minimum Rust version
137137

138-
The current minimum required Rust version is 1.41. Any change to this is
138+
The current minimum required Rust version is 1.49. Any change to this is
139139
considered a breaking change and will require a major version bump.
140140

141141
## License

core/src/spinwait.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
// copied, modified, or distributed except according to those terms.
77

88
use crate::thread_parker;
9-
use std::sync::atomic::spin_loop_hint;
9+
use core::hint::spin_loop;
1010

1111
// Wastes some CPU time for the given number of iterations,
1212
// using a hint to indicate to the CPU that we are spinning.
1313
#[inline]
1414
fn cpu_relax(iterations: u32) {
1515
for _ in 0..iterations {
16-
spin_loop_hint()
16+
spin_loop()
1717
}
1818
}
1919

core/src/thread_parker/generic.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
//! A simple spin lock based thread parker. Used on platforms without better
99
//! parking facilities available.
1010
11-
use core::sync::atomic::{spin_loop_hint, AtomicBool, Ordering};
11+
use core::sync::atomic::{AtomicBool, Ordering};
12+
use core::hint::spin_loop;
1213
use std::thread;
1314
use std::time::Instant;
1415

@@ -42,7 +43,7 @@ impl super::ThreadParkerT for ThreadParker {
4243
#[inline]
4344
unsafe fn park(&self) {
4445
while self.parked.load(Ordering::Acquire) != false {
45-
spin_loop_hint();
46+
spin_loop();
4647
}
4748
}
4849

@@ -52,7 +53,7 @@ impl super::ThreadParkerT for ThreadParker {
5253
if Instant::now() >= timeout {
5354
return false;
5455
}
55-
spin_loop_hint();
56+
spin_loop();
5657
}
5758
true
5859
}

0 commit comments

Comments
 (0)