From 8de850e7e990a18f48c85ff235d4ba11cf53d5ef Mon Sep 17 00:00:00 2001 From: 4lDO2 <4lDO2@protonmail.com> Date: Tue, 16 Jul 2024 20:33:37 +0200 Subject: [PATCH] Ensure all threads stop in exit(). --- src/syscall/process.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/syscall/process.rs b/src/syscall/process.rs index 23f610533f..abf06d1801 100644 --- a/src/syscall/process.rs +++ b/src/syscall/process.rs @@ -30,7 +30,13 @@ use crate::{ use super::usercopy::UserSliceWo; pub fn exit_context(context_lock: Arc>) { - // TODO: Stop context? + if !context::is_current(&context_lock) { + context_lock.write().status = context::Status::Dead; + while context_lock.read().running { + context::switch(); + } + } + let close_files; let addrspace_opt;