diff --git a/Core/HLE/sceKernelMutex.cpp b/Core/HLE/sceKernelMutex.cpp index 2044c88c06..da149aebba 100644 --- a/Core/HLE/sceKernelMutex.cpp +++ b/Core/HLE/sceKernelMutex.cpp @@ -826,7 +826,8 @@ static void __KernelWaitLwMutex(LwMutex *mutex, u32 timeoutPtr) { static bool __KernelUnlockLwMutexForThreadCheck(LwMutex *mutex, SceUID threadID, u32 &error, int result, bool &wokeThreads) { - if (mutex->nm.lockThread == -1 && __KernelUnlockLwMutexForThread(mutex, mutex->nm.workarea, threadID, error, 0)) + // The lock state lives in the workarea, nm.lockThread is only refreshed when referred. + if (mutex->nm.workarea->lockLevel == 0 && __KernelUnlockLwMutexForThread(mutex, mutex->nm.workarea, threadID, error, 0)) return true; return false; } diff --git a/pspautotests b/pspautotests index d2097ed7d8..33e59e29f2 160000 --- a/pspautotests +++ b/pspautotests @@ -1 +1 @@ -Subproject commit d2097ed7d840d39dddf37433726790cd2a446a1d +Subproject commit 33e59e29f2aad3c7440e5b1afeab1715268d72dc diff --git a/test.py b/test.py index 7515cbd36b..61af594c53 100755 --- a/test.py +++ b/test.py @@ -345,6 +345,7 @@ tests_good = [ "threads/fpl/refer", "threads/fpl/tryallocate", "threads/k0/k0", + "threads/lwmutex/callbacks", "threads/lwmutex/create", "threads/lwmutex/delete", "threads/lwmutex/lock",