From 55f50f302312bd8509ec5db47847452d98fbbe5b Mon Sep 17 00:00:00 2001 From: Dario Date: Sat, 14 Dec 2024 13:21:11 -0300 Subject: [PATCH] Fix front() to back(), use Mutex. --- UnleashedRecomp/kernel/imports.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/UnleashedRecomp/kernel/imports.cpp b/UnleashedRecomp/kernel/imports.cpp index 0878bc76..0b6bb974 100644 --- a/UnleashedRecomp/kernel/imports.cpp +++ b/UnleashedRecomp/kernel/imports.cpp @@ -904,7 +904,7 @@ DWORD KeWaitForSingleObject(XDISPATCHER_HEADER* Object, DWORD WaitReason, DWORD static thread_local std::vector KeTlsValues; static std::vector KeTlsFreeIndices; static size_t KeTlsNextIndex = 0; -static std::mutex KeTlsAllocationMutex; +static Mutex KeTlsAllocationMutex; static void KeTlsEnsureTlsCapacity(size_t index) { @@ -929,10 +929,10 @@ BOOL KeTlsSetValue(DWORD dwTlsIndex, DWORD lpTlsValue) DWORD KeTlsAlloc() { - std::lock_guard lock(KeTlsAllocationMutex); + std::lock_guard lock(KeTlsAllocationMutex); if (!KeTlsFreeIndices.empty()) { - size_t index = KeTlsFreeIndices.front(); + size_t index = KeTlsFreeIndices.back(); KeTlsFreeIndices.pop_back(); return index; } @@ -942,7 +942,7 @@ DWORD KeTlsAlloc() BOOL KeTlsFree(DWORD dwTlsIndex) { - std::lock_guard lock(KeTlsAllocationMutex); + std::lock_guard lock(KeTlsAllocationMutex); KeTlsFreeIndices.push_back(dwTlsIndex); return TRUE; }