Skip to content

Commit 3a54193

Browse files
committed
m: Use OnceLock instead of async-lock when useful
Bumps the MSRV to 1.70 Signed-off-by: John Nunley <[email protected]>
1 parent fead40f commit 3a54193

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ jobs:
9999
os: [ubuntu-latest, windows-latest]
100100
# When updating this, the reminder to update the minimum supported
101101
# Rust version in Cargo.toml.
102-
rust: ['1.63']
102+
rust: ['1.70']
103103
steps:
104104
- uses: actions/checkout@v4
105105
- name: Install Rust

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ name = "async-process"
66
version = "2.4.0"
77
authors = ["Stjepan Glavina <[email protected]>"]
88
edition = "2021"
9-
rust-version = "1.63"
9+
rust-version = "1.70"
1010
description = "Async interface for working with processes"
1111
license = "Apache-2.0 OR MIT"
1212
repository = "https://github.com/smol-rs/async-process"
@@ -15,14 +15,14 @@ categories = ["asynchronous", "os"]
1515
exclude = ["/.*"]
1616

1717
[dependencies]
18-
async-lock = "3.0.0"
1918
async-io = "2.3.0"
2019
cfg-if = "1.0"
2120
event-listener = "5.1.0"
2221
futures-lite = "2.0.0"
2322
tracing = { version = "0.1.40", default-features = false, optional = true }
2423

2524
[target.'cfg(unix)'.dependencies]
25+
async-lock = "3.0.0"
2626
async-signal = "0.2.3"
2727
rustix = { version = "1.0", default-features = false, features = ["std", "fs", "process"] }
2828

src/lib.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ use std::fmt;
6262
use std::path::Path;
6363
use std::pin::Pin;
6464
use std::sync::atomic::{AtomicUsize, Ordering};
65-
use std::sync::{Arc, Mutex};
65+
use std::sync::{Arc, Mutex, OnceLock};
6666
use std::task::{Context, Poll};
6767
use std::thread;
6868

@@ -74,7 +74,6 @@ use std::os::unix::io::{AsFd, AsRawFd, BorrowedFd, OwnedFd, RawFd};
7474
#[cfg(windows)]
7575
use blocking::Unblock;
7676

77-
use async_lock::OnceCell;
7877
use futures_lite::{future, io, prelude::*};
7978

8079
#[doc(no_inline)]
@@ -117,9 +116,9 @@ struct Reaper {
117116
impl Reaper {
118117
/// Get the singleton instance of the reaper.
119118
fn get() -> &'static Self {
120-
static REAPER: OnceCell<Reaper> = OnceCell::new();
119+
static REAPER: OnceLock<Reaper> = OnceLock::new();
121120

122-
REAPER.get_or_init_blocking(|| Reaper {
121+
REAPER.get_or_init(|| Reaper {
123122
sys: reaper::Reaper::new(),
124123
drivers: AtomicUsize::new(0),
125124
child_count: AtomicUsize::new(0),

0 commit comments

Comments
 (0)