std: move thread::current TLS variable out of thread_info
This commit is contained in:
@@ -24,8 +24,7 @@ pub use core::panicking::{panic_display, panic_fmt};
|
||||
|
||||
use crate::sync::Once;
|
||||
use crate::sys;
|
||||
use crate::sys_common::thread_info;
|
||||
use crate::thread::Thread;
|
||||
use crate::thread::{self, Thread};
|
||||
|
||||
// Prints to the "panic output", depending on the platform this may be:
|
||||
// - the standard error output
|
||||
@@ -96,13 +95,12 @@ unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) {
|
||||
unsafe {
|
||||
sys::init(argc, argv, sigpipe);
|
||||
|
||||
let main_guard = sys::thread::guard::init();
|
||||
// Next, set up the current Thread with the guard information we just
|
||||
// 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::new(Some(rtunwrap!(Ok, CString::new("main"))));
|
||||
thread_info::set(main_guard, thread);
|
||||
thread::set_current(thread);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user