coreinit: Log errors in OSUnlockMutex instead of debug asserts

This commit is contained in:
Exzap 2026-03-24 03:33:53 +01:00
parent f2f70e5df8
commit 6648a9c225

View File

@ -300,8 +300,16 @@ namespace coreinit
void OSUnlockMutexInternal(OSMutex* mutex)
{
OSThread_t* currentThread = OSGetCurrentThread();
cemu_assert_debug(mutex->owner == currentThread);
cemu_assert_debug(mutex->lockCount > 0);
if (mutex->lockCount == 0)
{
cemuLog_log(LogType::APIErrors, "OSUnlockMutex called on a mutex which is not locked");
return;
}
if (mutex->owner != currentThread)
{
cemuLog_log(LogType::APIErrors, "OSUnlockMutex called by a different thread than the one owning it (owner=0x{:08x} currentThread=0x{:08x})", mutex->owner.GetMPTR(), MEMPTR<void>(currentThread).GetMPTR());
return;
}
mutex->lockCount = mutex->lockCount - 1;
if (mutex->lockCount == 0)
{