Skip to content

Commit c41655b

Browse files
committed
rollup merge of rust-lang#21920: vojtechkral/main-thread-name
Fixes rust-lang#21911
2 parents 6cf75ca + 7d2404c commit c41655b

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/libstd/sys/common/thread_info.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,6 @@ pub fn stack_guard() -> uint {
5656

5757
pub fn set(stack_bounds: (uint, uint), stack_guard: uint, thread: Thread) {
5858
THREAD_INFO.with(|c| assert!(c.borrow().is_none()));
59-
match thread.name() {
60-
Some(name) => unsafe { ::sys::thread::set_name(name); },
61-
None => {}
62-
}
6359
THREAD_INFO.with(move |c| *c.borrow_mut() = Some(ThreadInfo{
6460
stack_bounds: stack_bounds,
6561
stack_guard: stack_guard,

src/libstd/thread.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ use ops::{Drop, FnOnce};
156156
use option::Option::{self, Some, None};
157157
use result::Result::{Err, Ok};
158158
use sync::{Mutex, Condvar, Arc};
159+
use str::Str;
159160
use string::String;
160161
use rt::{self, unwind};
161162
use old_io::{Writer, stdio};
@@ -280,6 +281,10 @@ impl Builder {
280281
unsafe {
281282
stack::record_os_managed_stack_bounds(my_stack_bottom, my_stack_top);
282283
}
284+
match their_thread.name() {
285+
Some(name) => unsafe { imp::set_name(name.as_slice()); },
286+
None => {}
287+
}
283288
thread_info::set(
284289
(my_stack_bottom, my_stack_top),
285290
unsafe { imp::guard::current() },

0 commit comments

Comments
 (0)