From 0305830e320a6b849cfc2c7f48db9389631bc451 Mon Sep 17 00:00:00 2001 From: "Justin C. Miller" Date: Mon, 18 Jan 2021 18:24:18 -0800 Subject: [PATCH] [kernel] fix thread_create handle bug thread_create was setting the handle it returned to be that of the parent process, not the thread it created. --- src/kernel/syscalls/thread.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kernel/syscalls/thread.cpp b/src/kernel/syscalls/thread.cpp index 49091b2..74efede 100644 --- a/src/kernel/syscalls/thread.cpp +++ b/src/kernel/syscalls/thread.cpp @@ -15,7 +15,7 @@ thread_create(void *rip, j6_handle_t *handle) thread *child = p.create_thread(); child->add_thunk_user(reinterpret_cast(rip)); - *handle = p.self_handle(); + *handle = child->self_handle(); child->clear_state(thread::state::loading); child->set_state(thread::state::ready);