Skip to content

Commit 2f345b3

Browse files
committed
Merge branch 'NoSTDBevyTasks' of https://github.com/bushrat011899/bevy into NoSTDBevyTasks
2 parents eee356d + 8bda189 commit 2f345b3

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

crates/bevy_tasks/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ fastrand = { version = "2.0.0", default-features = false }
3030
spin = { version = "0.9.8", default-features = false, features = [
3131
"spin_mutex",
3232
"rwlock",
33+
"once",
3334
] }
3435
concurrent-queue = { version = "2.0.0" }
3536

crates/bevy_tasks/src/global_task_pool.rs

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

44
use spin::RwLock;

crates/bevy_tasks/src/usages.rs

Lines changed: 3 additions & 3 deletions
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)