about summary refs log tree commit diff
path: root/src/libstd/thread.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstd/thread.rs')
-rw-r--r--src/libstd/thread.rs16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/libstd/thread.rs b/src/libstd/thread.rs
index 4c7dcc8b9eb..5c5f9f75fd9 100644
--- a/src/libstd/thread.rs
+++ b/src/libstd/thread.rs
@@ -281,17 +281,13 @@ impl Builder {
             let my_stack_top = addr as usize;
             let my_stack_bottom = my_stack_top - stack_size + 1024;
             unsafe {
-                stack::record_os_managed_stack_bounds(my_stack_bottom, my_stack_top);
-            }
-            match their_thread.name() {
-                Some(name) => unsafe { imp::set_name(name); },
-                None => {}
+                if let Some(name) = their_thread.name() {
+                    imp::set_name(name);
+                }
+                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() {