diff options
| author | Mara Bos <m-ou.se@m-ou.se> | 2024-10-24 10:52:47 +0200 |
|---|---|---|
| committer | Mara Bos <m-ou.se@m-ou.se> | 2024-11-19 18:54:20 +0100 |
| commit | 947354fbec27766f3a99c13c90413cc22739108c (patch) | |
| tree | aa50a33d0f81b4ae07e45d3c147eacc1532f9488 /library/std/src/thread/mod.rs | |
| parent | ef9055f3eef409e99e1e786f6a90a1684fde810d (diff) | |
| download | rust-947354fbec27766f3a99c13c90413cc22739108c.tar.gz rust-947354fbec27766f3a99c13c90413cc22739108c.zip | |
Update thread spawn hooks.
1. Make the effect thread local. 2. Don't return a io::Result from hooks.
Diffstat (limited to 'library/std/src/thread/mod.rs')
| -rw-r--r-- | library/std/src/thread/mod.rs | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/library/std/src/thread/mod.rs b/library/std/src/thread/mod.rs index c6b1e0de84c..79621e7fa6b 100644 --- a/library/std/src/thread/mod.rs +++ b/library/std/src/thread/mod.rs @@ -491,7 +491,7 @@ impl Builder { None => Thread::new_unnamed(id), }; - let hooks = spawnhook::run_spawn_hooks(&my_thread)?; + let hooks = spawnhook::run_spawn_hooks(&my_thread); let their_thread = my_thread.clone(); @@ -539,12 +539,9 @@ impl Builder { imp::Thread::set_name(name); } - for hook in hooks { - hook(); - } - let f = f.into_inner(); let try_result = panic::catch_unwind(panic::AssertUnwindSafe(|| { + crate::sys::backtrace::__rust_begin_short_backtrace(|| hooks.run()); crate::sys::backtrace::__rust_begin_short_backtrace(f) })); // SAFETY: `their_packet` as been built just above and moved by the |
