From 930caab8f9857fd1965a6392378edc6967b5a355 Mon Sep 17 00:00:00 2001 From: Amanieu d'Antras Date: Fri, 28 Jan 2022 13:06:24 +0000 Subject: [PATCH 1/2] Use core::hint::spin_loop instead of the deprecated spin_loop_hint. Bumps MSRV to 1.49.0 --- .github/workflows/rust.yml | 4 ++-- README.md | 2 +- core/src/spinwait.rs | 4 ++-- core/src/thread_parker/generic.rs | 7 ++++--- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 81b35765..e1286568 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -16,11 +16,11 @@ jobs: strategy: matrix: os: [ubuntu, macos, windows] - channel: [1.41.0, stable, beta, nightly] + channel: [1.49.0, stable, beta, nightly] feature: [arc_lock, serde, deadlock_detection] exclude: - feature: deadlock_detection - channel: '1.41.0' + channel: '1.49.0' include: - channel: nightly feature: nightly diff --git a/README.md b/README.md index fe87ef6e..5bda8d85 100644 --- a/README.md +++ b/README.md @@ -135,7 +135,7 @@ changes to the core API do not cause breaking changes for users of `parking_lot` ## Minimum Rust version -The current minimum required Rust version is 1.41. Any change to this is +The current minimum required Rust version is 1.49. Any change to this is considered a breaking change and will require a major version bump. ## License diff --git a/core/src/spinwait.rs b/core/src/spinwait.rs index ad0327a3..a57f4c10 100644 --- a/core/src/spinwait.rs +++ b/core/src/spinwait.rs @@ -6,14 +6,14 @@ // copied, modified, or distributed except according to those terms. use crate::thread_parker; -use std::sync::atomic::spin_loop_hint; +use core::hint::spin_loop; // Wastes some CPU time for the given number of iterations, // using a hint to indicate to the CPU that we are spinning. #[inline] fn cpu_relax(iterations: u32) { for _ in 0..iterations { - spin_loop_hint() + spin_loop() } } diff --git a/core/src/thread_parker/generic.rs b/core/src/thread_parker/generic.rs index 6d9963b9..990bcb7f 100644 --- a/core/src/thread_parker/generic.rs +++ b/core/src/thread_parker/generic.rs @@ -8,7 +8,8 @@ //! A simple spin lock based thread parker. Used on platforms without better //! parking facilities available. -use core::sync::atomic::{spin_loop_hint, AtomicBool, Ordering}; +use core::sync::atomic::{AtomicBool, Ordering}; +use core::hint::spin_loop; use std::thread; use std::time::Instant; @@ -42,7 +43,7 @@ impl super::ThreadParkerT for ThreadParker { #[inline] unsafe fn park(&self) { while self.parked.load(Ordering::Acquire) != false { - spin_loop_hint(); + spin_loop(); } } @@ -52,7 +53,7 @@ impl super::ThreadParkerT for ThreadParker { if Instant::now() >= timeout { return false; } - spin_loop_hint(); + spin_loop(); } true } From a4e4a021dc4efe2c327777ef85c13f0716675766 Mon Sep 17 00:00:00 2001 From: Amanieu d'Antras Date: Fri, 28 Jan 2022 13:18:20 +0000 Subject: [PATCH 2/2] Only run CI for bors and pull requests --- .github/workflows/rust.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index e1286568..4d335939 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -2,11 +2,11 @@ name: Rust on: push: - branches-ignore: - - trying.tmp - - staging.tmp + branches: + - trying + - staging pull_request: - + env: RUST_TEST_THREADS: 1