You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While porting Mednafen I noticed that I was getting a deadlock situation. I think the following:
if (mutex->kind == PTHREAD_MUTEX_ERRORCHECK) {
SHOWMSG("MutexAttempt");
BOOL isLocked = MutexAttempt(mutex->mutex);
if (!isLocked) {
SHOWMSG("DeadLock");
return EDEADLK;
}
}
MutexAttempt (ExecSG):
* NAME
* MutexAttempt -- Try to lock a mutex (V52)
*
* SYNOPSIS
* BOOL MutexAttempt(APTR mx);
*
* FUNCTION
* This function attempts to lock the mutex mx. This function will never
It looks like we are locking the mutex, checking that it was not locked and then, because of that, trying to lock it again. Although, I can see the idea for MutexAttempt is to see whether or not we can get the mutex and if it already is locked the idea would be to check !isLocked and return EDEADLK - but that is not happening in the test case. But if it does lock then we need to handle that and not try to lock it again.
The text was updated successfully, but these errors were encountered:
PTHREAD_MUTEX_ERRORCHECK.zip
The code above are snippets from Mednafen.
While porting Mednafen I noticed that I was getting a deadlock situation. I think the following:
MutexAttempt (ExecSG):
It looks like we are locking the mutex, checking that it was not locked and then, because of that, trying to lock it again. Although, I can see the idea for MutexAttempt is to see whether or not we can get the mutex and if it already is locked the idea would be to check !isLocked and return EDEADLK - but that is not happening in the test case. But if it does lock then we need to handle that and not try to lock it again.
The text was updated successfully, but these errors were encountered: