Skip to content

Commit

Permalink
Merge branch 'NoSTDBevyTasks' of https://github.com/bushrat011899/bevy
Browse files Browse the repository at this point in the history
…into NoSTDBevyTasks
  • Loading branch information
bushrat011899 committed Sep 23, 2024
2 parents eee356d + 8bda189 commit 2f345b3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions crates/bevy_tasks/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ fastrand = { version = "2.0.0", default-features = false }
spin = { version = "0.9.8", default-features = false, features = [
"spin_mutex",
"rwlock",
"once",
] }
concurrent-queue = { version = "2.0.0" }

Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_tasks/src/global_task_pool.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use alloc::sync::Arc;
use alloc::{vec::Vec, sync::Arc, string::String};
use core::{cell::RefCell, future::Future, marker::PhantomData, mem};

use spin::RwLock;
Expand Down
6 changes: 3 additions & 3 deletions crates/bevy_tasks/src/usages.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use super::TaskPool;
use core::ops::Deref;
use std::sync::OnceLock;
use spin::Once;

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

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

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

0 comments on commit 2f345b3

Please sign in to comment.