Skip to content

Commit 44788a6

Browse files
committed
Use std::sync::OnceLock instead of async_lock::OnceCell
1 parent 1532526 commit 44788a6

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/spawn.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
use std::future::Future;
22
use std::panic::catch_unwind;
3+
use std::sync::OnceLock;
34
use std::thread;
45

56
use async_executor::{Executor, Task};
67
use async_io::block_on;
7-
use async_lock::OnceCell;
88
use futures_lite::future;
99

1010
/// Spawns a task onto the global executor (single-threaded by default).
@@ -31,10 +31,10 @@ use futures_lite::future;
3131
/// });
3232
/// ```
3333
pub fn spawn<T: Send + 'static>(future: impl Future<Output = T> + Send + 'static) -> Task<T> {
34-
static GLOBAL: OnceCell<Executor<'_>> = OnceCell::new();
34+
static GLOBAL: OnceLock<Executor<'_>> = OnceLock::new();
3535

3636
fn global() -> &'static Executor<'static> {
37-
GLOBAL.get_or_init_blocking(|| {
37+
GLOBAL.get_or_init(|| {
3838
let num_threads = {
3939
// Parse SMOL_THREADS or default to 1.
4040
std::env::var("SMOL_THREADS")

0 commit comments

Comments
 (0)