Skip to content

Commit d8828e4

Browse files
committed
add maybesend and maybesync to single threaded
1 parent d3bb78e commit d8828e4

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

crates/bevy_tasks/src/single_threaded_task_pool.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,15 +277,21 @@ impl TaskPool {
277277
/// the browser. Consider using [`spawn_blocking_async`] instead.
278278
///
279279
/// [`spawn_blocking_async`]: Self::spawn_blocking_async
280-
pub fn spawn_blocking<T>(&self, f: impl FnOnce() -> T + 'static) -> Task<T>
280+
pub fn spawn_blocking<T>(
281+
&self,
282+
f: impl FnOnce() -> T + 'static + MaybeSend + MaybeSync,
283+
) -> Task<T>
281284
where
282285
T: 'static + MaybeSend + MaybeSync,
283286
{
284287
self.spawn(async { f() })
285288
}
286289

287290
/// Spawns a static future on the JS event loop. This is exactly the same as [`TaskPool::spawn`].
288-
pub fn spawn_blocking_async<T>(&self, future: impl Future<Output = T> + 'static) -> Task<T>
291+
pub fn spawn_blocking_async<T>(
292+
&self,
293+
future: impl Future<Output = T> + 'static + MaybeSend + MaybeSync,
294+
) -> Task<T>
289295
where
290296
T: 'static + MaybeSend + MaybeSync,
291297
{

0 commit comments

Comments
 (0)