about summary refs log tree commit diff
path: root/library/std/src/thread/spawnhook.rs
diff options
context:
space:
mode:
authorMara Bos <m-ou.se@m-ou.se>2024-10-24 11:19:02 +0200
committerMara Bos <m-ou.se@m-ou.se>2024-11-19 18:54:20 +0100
commitf2bf9e198ea183f0a490f93caa3d43678c8fa0a1 (patch)
tree8a6b456a24fcaaf1bbfd8dcdc51dfd39bc6d04f9 /library/std/src/thread/spawnhook.rs
parent947354fbec27766f3a99c13c90413cc22739108c (diff)
downloadrust-f2bf9e198ea183f0a490f93caa3d43678c8fa0a1.tar.gz
rust-f2bf9e198ea183f0a490f93caa3d43678c8fa0a1.zip
Add thread Builder::no_hooks().
Diffstat (limited to 'library/std/src/thread/spawnhook.rs')
-rw-r--r--library/std/src/thread/spawnhook.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/library/std/src/thread/spawnhook.rs b/library/std/src/thread/spawnhook.rs
index 9c4e9eb6aa1..b0732ae69c3 100644
--- a/library/std/src/thread/spawnhook.rs
+++ b/library/std/src/thread/spawnhook.rs
@@ -104,7 +104,7 @@ where
 /// Called on the parent thread.
 ///
 /// Returns the functions to be called on the newly spawned thread.
-pub(super) fn run_spawn_hooks(thread: &Thread) -> SpawnHookResults {
+pub(super) fn run_spawn_hooks(thread: &Thread) -> ChildSpawnHooks {
     // Get a snapshot of the spawn hooks.
     // (Increments the refcount to the first node.)
     let hooks = SPAWN_HOOKS.with(|hooks| {
@@ -121,19 +121,20 @@ pub(super) fn run_spawn_hooks(thread: &Thread) -> SpawnHookResults {
     }
     // Pass on the snapshot of the hooks and the results to the new thread,
     // which will then run SpawnHookResults::run().
-    SpawnHookResults { hooks, to_run }
+    ChildSpawnHooks { hooks, to_run }
 }
 
 /// The results of running the spawn hooks.
 ///
 /// This struct is sent to the new thread.
 /// It contains the inherited hooks and the closures to be run.
-pub(super) struct SpawnHookResults {
+#[derive(Default)]
+pub(super) struct ChildSpawnHooks {
     hooks: SpawnHooks,
     to_run: Vec<Box<dyn FnOnce() + Send>>,
 }
 
-impl SpawnHookResults {
+impl ChildSpawnHooks {
     // This is run on the newly spawned thread, directly at the start.
     pub(super) fn run(self) {
         SPAWN_HOOKS.set(self.hooks);