Skip to content

Commit 032bbde

Browse files
committed
concurrent-queue
1 parent ac9ac9c commit 032bbde

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

crates/bevy_tasks/Cargo.toml

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ std = [
1818
"slab/std",
1919
"fastrand/std",
2020
"spin/std",
21+
"concurrent-queue/std",
2122
]
2223

2324
[dependencies]
@@ -30,8 +31,9 @@ fastrand = { version = "2.0.0", default-features = false }
3031
spin = { version = "0.9.8", default-features = false, features = [
3132
"spin_mutex",
3233
"rwlock",
34+
"once",
3335
] }
34-
concurrent-queue = { version = "2.0.0" }
36+
concurrent-queue = { version = "2.0.0", default-features = false }
3537

3638
bevy_utils = { path = "../bevy_utils", version = "0.15.0-dev", default-features = false }
3739

crates/bevy_tasks/src/global_task_pool.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use alloc::sync::Arc;
1+
use alloc::{string::String, sync::Arc, vec::Vec};
22
use core::{cell::RefCell, future::Future, marker::PhantomData, mem};
33

44
use spin::RwLock;

crates/bevy_tasks/src/usages.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
use super::TaskPool;
22
use core::ops::Deref;
3-
use std::sync::OnceLock;
3+
use spin::Once;
44

55
macro_rules! taskpool {
66
($(#[$attr:meta])* ($static:ident, $type:ident)) => {
7-
static $static: OnceLock<$type> = OnceLock::new();
7+
static $static: Once<$type> = Once::new();
88

99
$(#[$attr])*
1010
#[derive(Debug)]
@@ -13,7 +13,7 @@ macro_rules! taskpool {
1313
impl $type {
1414
#[doc = concat!(" Gets the global [`", stringify!($type), "`] instance, or initializes it with `f`.")]
1515
pub fn get_or_init(f: impl FnOnce() -> TaskPool) -> &'static Self {
16-
$static.get_or_init(|| Self(f()))
16+
$static.call_once(|| Self(f()))
1717
}
1818

1919
#[doc = concat!(" Attempts to get the global [`", stringify!($type), "`] instance, \

0 commit comments

Comments
 (0)