From 54dd9f4eae02d0a7580eeaa11248abf1f6fc1ca5 Mon Sep 17 00:00:00 2001 From: Eladash Date: Thu, 14 May 2020 17:43:53 +0300 Subject: [PATCH] sys_spu: Fix sys_spu_thread_group_terminate vs sys_spu_thread_group_exit race on values --- rpcs3/Emu/Cell/SPUThread.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rpcs3/Emu/Cell/SPUThread.cpp b/rpcs3/Emu/Cell/SPUThread.cpp index 6a223535c197..41600be028de 100644 --- a/rpcs3/Emu/Cell/SPUThread.cpp +++ b/rpcs3/Emu/Cell/SPUThread.cpp @@ -3179,6 +3179,12 @@ bool spu_thread::stop_and_signal(u32 code) continue; } + if (std::exchange(group->set_terminate, true)) + { + // Whoever terminated first decides the error status + cause + return true; + } + for (auto& thread : group->threads) { if (thread && thread.get() != this)