From 9e224c2bf18ebf8f871efb2e1aba43ed7970ebb7 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 19 Dec 2014 11:29:39 -0800 Subject: std: Re-enable at_exit() The new semantics of this function are that the callbacks are run when the *main thread* exits, not when all threads have exited. This implies that other threads may still be running when the `at_exit` callbacks are invoked and users need to be prepared for this situation. Users in the standard library have been audited in accordance to these new rules as well. Closes #20012 --- src/libstd/thread.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src/libstd/thread.rs') diff --git a/src/libstd/thread.rs b/src/libstd/thread.rs index a7b3ee996a3..cfdb5c2ec26 100644 --- a/src/libstd/thread.rs +++ b/src/libstd/thread.rs @@ -232,13 +232,10 @@ impl Builder { let my_stack_top = addr as uint; let my_stack_bottom = my_stack_top - stack_size + 1024; unsafe { - stack::record_os_managed_stack_bounds(my_stack_bottom, my_stack_top); + stack::record_os_managed_stack_bounds(my_stack_bottom, + my_stack_top); + thread_info::set(imp::guard::current(), their_thread); } - thread_info::set( - (my_stack_bottom, my_stack_top), - unsafe { imp::guard::current() }, - their_thread - ); let mut output = None; let f: Thunk<(), T> = if stdout.is_some() || stderr.is_some() { -- cgit 1.4.1-3-g733a5