From 3c857d746ef89ac8106694fbb032c6f997b920b9 Mon Sep 17 00:00:00 2001 From: jellllly420 Date: Fri, 18 Oct 2024 11:41:21 +0800 Subject: [PATCH] Clear TID before doing futex_wake when exiting a POSIX thread --- kernel/src/process/posix_thread/exit.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/src/process/posix_thread/exit.rs b/kernel/src/process/posix_thread/exit.rs index 1f92d1839..d81733ec7 100644 --- a/kernel/src/process/posix_thread/exit.rs +++ b/kernel/src/process/posix_thread/exit.rs @@ -24,11 +24,11 @@ pub fn do_exit(thread: &Thread, posix_thread: &PosixThread, term_status: TermSta let mut clear_ctid = posix_thread.clear_child_tid().lock(); // If clear_ctid !=0 ,do a futex wake and write zero to the clear_ctid addr. if *clear_ctid != 0 { - futex_wake(*clear_ctid, 1, None)?; // FIXME: the correct write length? if let Err(e) = get_current_userspace!().write_val(*clear_ctid, &0u32) { debug!("Ignore error during exit process: {:?}", e); } + futex_wake(*clear_ctid, 1, None)?; *clear_ctid = 0; } // exit the robust list: walk the robust list; mark futex words as dead and do futex wake