From 177078813b65d62b7eda12edcb605e2cd8fb5444 Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Tue, 16 Jan 2024 20:57:28 +0100 Subject: [PATCH] Tier0: fix CThreadFastMutex bug Must break if ThreadInterlockedCompareExchange returns null. --- r5dev/tier0/threadtools.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/r5dev/tier0/threadtools.cpp b/r5dev/tier0/threadtools.cpp index 0972a0c3..5a0d0000 100644 --- a/r5dev/tier0/threadtools.cpp +++ b/r5dev/tier0/threadtools.cpp @@ -43,7 +43,7 @@ int CThreadFastMutex::Lock(void) result = ThreadInterlockedCompareExchange((volatile LONG*)&m_lAddend, 0, 1); - if (result) + if (!result) break; if (++cycle > 5)