From 15bac4f115e19a3f9b3d1e5634cb7af3c513fd4d Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Thu, 24 Oct 2024 11:37:35 +0200 Subject: [PATCH] Use Send + Sync for spawn hooks. --- std/src/thread/spawnhook.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/std/src/thread/spawnhook.rs b/std/src/thread/spawnhook.rs index b0732ae69c302..f9a4a2e0da7da 100644 --- a/std/src/thread/spawnhook.rs +++ b/std/src/thread/spawnhook.rs @@ -24,7 +24,7 @@ impl Drop for SpawnHooks { } struct SpawnHook { - hook: Box Box>, + hook: Box Box>, next: Option>, } @@ -86,7 +86,7 @@ struct SpawnHook { #[unstable(feature = "thread_spawn_hook", issue = "none")] pub fn add_spawn_hook(hook: F) where - F: 'static + Sync + Fn(&Thread) -> G, + F: 'static + Send + Sync + Fn(&Thread) -> G, G: 'static + Send + FnOnce(), { SPAWN_HOOKS.with(|h| {