mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
Use Send + Sync for spawn hooks.
This commit is contained in:
parent
f2bf9e198e
commit
5a80b48fe1
@ -24,7 +24,7 @@ impl Drop for SpawnHooks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct SpawnHook {
|
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>>,
|
next: Option<Arc<SpawnHook>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ struct SpawnHook {
|
|||||||
#[unstable(feature = "thread_spawn_hook", issue = "none")]
|
#[unstable(feature = "thread_spawn_hook", issue = "none")]
|
||||||
pub fn add_spawn_hook<F, G>(hook: F)
|
pub fn add_spawn_hook<F, G>(hook: F)
|
||||||
where
|
where
|
||||||
F: 'static + Sync + Fn(&Thread) -> G,
|
F: 'static + Send + Sync + Fn(&Thread) -> G,
|
||||||
G: 'static + Send + FnOnce(),
|
G: 'static + Send + FnOnce(),
|
||||||
{
|
{
|
||||||
SPAWN_HOOKS.with(|h| {
|
SPAWN_HOOKS.with(|h| {
|
||||||
|
Loading…
Reference in New Issue
Block a user