about summary refs log tree commit diff
path: root/src/libstd/thread.rs
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-12-19 11:29:39 -0800
committerAlex Crichton <alex@alexcrichton.com>2014-12-30 14:33:59 -0800
commit9e224c2bf18ebf8f871efb2e1aba43ed7970ebb7 (patch)
treeda18d5791e6841a1aa6a9469baca155d4ca9828d /src/libstd/thread.rs
parentd2368c3c11ddab9d812c4ddec2e44579326ad347 (diff)
downloadrust-9e224c2bf18ebf8f871efb2e1aba43ed7970ebb7.tar.gz
rust-9e224c2bf18ebf8f871efb2e1aba43ed7970ebb7.zip
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
Diffstat (limited to 'src/libstd/thread.rs')
-rw-r--r--src/libstd/thread.rs9
1 files changed, 3 insertions, 6 deletions
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() {