Added message guard to not spam terminal with mutex warnings when GUI thread is blocking emulation thread from executing.

This commit is contained in:
mjbudd77 2021-12-29 21:11:02 -05:00
parent 9fd2bf559c
commit a891b080c5
1 changed files with 7 additions and 1 deletions

View File

@ -1307,6 +1307,7 @@ bool fceuWrapperIsLocked(void)
int fceuWrapperUpdate( void ) int fceuWrapperUpdate( void )
{ {
bool lock_acq; bool lock_acq;
static bool mutexLockFail = false;
// If a request is pending, // If a request is pending,
// sleep to allow request to be serviced. // sleep to allow request to be serviced.
@ -1321,12 +1322,17 @@ int fceuWrapperUpdate( void )
{ {
if ( GameInfo ) if ( GameInfo )
{ {
printf("Error: Emulator Failed to Acquire Mutex\n"); if ( !mutexLockFail )
{
printf("Warning: Emulator Thread Failed to Acquire Mutex - GUI has Lock\n");
}
mutexLockFail = true;
} }
msleep( 16 ); msleep( 16 );
return -1; return -1;
} }
mutexLockFail = false;
emulatorHasMutex = 1; emulatorHasMutex = 1;
if ( GameInfo ) if ( GameInfo )