about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMara Bos <m-ou.se@m-ou.se>2024-10-24 11:37:35 +0200
committerMara Bos <m-ou.se@m-ou.se>2024-11-19 18:54:20 +0100
commit5a80b48fe17f8ea772125dbc5220a134b1b15c68 (patch)
tree09e0e040dcc76a0b0f02680a15a7b399cdffe4bb
parentf2bf9e198ea183f0a490f93caa3d43678c8fa0a1 (diff)
downloadrust-5a80b48fe17f8ea772125dbc5220a134b1b15c68.tar.gz
rust-5a80b48fe17f8ea772125dbc5220a134b1b15c68.zip
Use Send + Sync for spawn hooks.
-rw-r--r--library/std/src/thread/spawnhook.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/library/std/src/thread/spawnhook.rs b/library/std/src/thread/spawnhook.rs
index b0732ae69c3..f9a4a2e0da7 100644
--- a/library/std/src/thread/spawnhook.rs
+++ b/library/std/src/thread/spawnhook.rs
@@ -24,7 +24,7 @@ impl Drop for SpawnHooks {
 }
 
 struct SpawnHook {
-    hook: Box<dyn Sync + Fn(&Thread) -> Box<dyn Send + FnOnce()>>,
+    hook: Box<dyn Send + Sync + Fn(&Thread) -> Box<dyn Send + FnOnce()>>,
     next: Option<Arc<SpawnHook>>,
 }
 
@@ -86,7 +86,7 @@ struct SpawnHook {
 #[unstable(feature = "thread_spawn_hook", issue = "none")]
 pub fn add_spawn_hook<F, G>(hook: F)
 where
-    F: 'static + Sync + Fn(&Thread) -> G,
+    F: 'static + Send + Sync + Fn(&Thread) -> G,
     G: 'static + Send + FnOnce(),
 {
     SPAWN_HOOKS.with(|h| {