From eb14ec87b2d4e1fd585765bbf9b9a83fe1c6fbaa Mon Sep 17 00:00:00 2001 From: Rafael Fritsch Date: Tue, 28 May 2019 14:43:36 +0200 Subject: [PATCH] !XB (Threading) (CE-19728) Use auto lock to avoid possible double unlock Copied from Perforce Change: 1978129 --- Code/CryEngine/CrySystem/SystemThreading.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Code/CryEngine/CrySystem/SystemThreading.cpp b/Code/CryEngine/CrySystem/SystemThreading.cpp index 24db36d5a..981995062 100644 --- a/Code/CryEngine/CrySystem/SystemThreading.cpp +++ b/Code/CryEngine/CrySystem/SystemThreading.cpp @@ -259,7 +259,7 @@ bool CThreadManager::JoinThread(IThread* pThreadTask, EJoinMode eJoinMode) } // Wait for completion of the target thread exit condition - pThreadImpl->m_threadExitMutex.Lock(); + AUTO_LOCK_T(decltype(pThreadImpl->m_threadExitMutex), pThreadImpl->m_threadExitMutex); while (pThreadImpl->m_isRunning) { #if !CRY_PLATFORM_ORBIS @@ -270,14 +270,12 @@ bool CThreadManager::JoinThread(IThread* pThreadTask, EJoinMode eJoinMode) // 2) If pThreadImpl->m_isRunning == false we would not be in this loop. Hence there is no double call of UnregisterThread() if (!CryThreadUtil::CryIsThreadAlive(pThreadImpl->m_threadHandle)) { - pThreadImpl->m_threadExitMutex.Unlock(); pThreadImpl->m_pThreadMngr->UnregisterThread(pThreadImpl->m_pThreadTask); break; } #endif pThreadImpl->m_threadExitCondition.Wait(pThreadImpl->m_threadExitMutex); } - pThreadImpl->m_threadExitMutex.Unlock(); return true; } -- 2.11.4.GIT