Skip to content

Commit

Permalink
Use Send + Sync for spawn hooks.
Browse files Browse the repository at this point in the history
  • Loading branch information
m-ou-se committed Oct 24, 2024
1 parent 1a7f3ed commit 1d36ef6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions library/std/src/thread/spawnhook.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>>,
}

Expand Down Expand Up @@ -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| {
Expand Down

0 comments on commit 1d36ef6

Please sign in to comment.