From 0df06960e11ec001777ede1e2ccc7d224431d229 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Thu, 10 Sep 2020 18:21:16 -0700 Subject: [PATCH] Ensures a process that has forked won't shutdown the other process Since we track the PID and TID of the threads for signaling purposes, we had the problem that if a process forked and the child then shuts down. It was still tracking the parent thread as executing, thus it would send it a tgkill to shut it down. This was unintended behaviour and is now stopped --- .../FEXCore/Source/Interface/HLE/Syscalls/Thread.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/External/FEXCore/Source/Interface/HLE/Syscalls/Thread.cpp b/External/FEXCore/Source/Interface/HLE/Syscalls/Thread.cpp index 385298a7e..d8c0e798f 100644 --- a/External/FEXCore/Source/Interface/HLE/Syscalls/Thread.cpp +++ b/External/FEXCore/Source/Interface/HLE/Syscalls/Thread.cpp @@ -80,6 +80,17 @@ namespace FEXCore::HLE { // update the internal TID Thread->State.ThreadManager.TID = ::gettid(); Thread->State.ThreadManager.PID = ::getpid(); + Thread->State.ThreadManager.clear_child_tid = nullptr; + + // Clear all the other threads that are being tracked + for (auto &DeadThread : Thread->CTX->Threads) { + if (DeadThread == Thread) { + continue; + } + + // Setting running to false ensures that when they shutdown we won't send signals to kill them + DeadThread->State.RunningEvents.Running = false; + } // only a single thread running so no need to remove anything from the thread array