Skip to content
Snippets Groups Projects
Verified Commit 44ec1676 authored by Jacob Lorentzon's avatar Jacob Lorentzon :speech_balloon:
Browse files

Activate new threads' TCBs early.

parent 01ce7f5a
No related branches found
No related tags found
No related merge requests found
......@@ -430,6 +430,8 @@ pub unsafe fn arch_pre(stack: &mut SigStack, area: &mut SigArea) {
static SUPPORTS_AVX: AtomicU8 = AtomicU8::new(1); // FIXME
// __relibc will be prepended to the name, so mangling is fine
#[no_mangle]
pub unsafe fn manually_enter_trampoline() {
let c = &Tcb::current().unwrap().os_specific.control;
c.control_flags.store(
......
......@@ -244,6 +244,10 @@ unsafe extern "C" fn new_thread_shim(
mutex1: *const Mutex<MaybeUninit<OsTid>>,
mutex2: *const Mutex<u64>,
) -> ! {
if let Some(tcb) = tcb.as_mut() {
tcb.activate();
}
let procmask = (&*mutex2).as_ptr().read();
let tid = (*(&*mutex1).lock()).assume_init();
......@@ -256,7 +260,6 @@ unsafe extern "C" fn new_thread_shim(
if let Some(tcb) = tcb.as_mut() {
tcb.copy_masters().unwrap();
tcb.activate();
}
(*tcb).pthread.os_tid.get().write(Sys::current_os_tid());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment