use panic;
use sys;
use sys_common;
- use sys_common::thread_info::{self, NewThread};
+ use sys_common::thread_info;
use thread::Thread;
sys::init();
// created. Note that this isn't necessary in general for new threads,
// but we just do this to name the main thread and to give it correct
// info about the stack bounds.
- let thread: Thread = NewThread::new(Some("main".to_owned()));
+ let thread = Thread::new(Some("main".to_owned()));
thread_info::set(main_guard, thread);
// Store our args if necessary in a squirreled away location
if c.borrow().is_none() {
*c.borrow_mut() = Some(ThreadInfo {
stack_guard: None,
- thread: NewThread::new(None),
+ thread: Thread::new(None),
})
}
Some(f(c.borrow_mut().as_mut().unwrap()))
thread: thread,
}));
}
-
-// a hack to get around privacy restrictions; implemented by `std::thread`
-pub trait NewThread {
- fn new(name: Option<String>) -> Self;
-}
impl Thread {
// Used only internally to construct a thread object without spawning
- fn new(name: Option<String>) -> Thread {
+ pub(crate) fn new(name: Option<String>) -> Thread {
let cname = name.map(|n| {
CString::new(n).expect("thread name may not contain interior null bytes")
});
}
}
-// a hack to get around privacy restrictions
-impl thread_info::NewThread for Thread {
- fn new(name: Option<String>) -> Thread { Thread::new(name) }
-}
-
////////////////////////////////////////////////////////////////////////////////
// JoinHandle
////////////////////////////////////////////////////////////////////////////////