From a891b080c55cbaf26215a8a06c3ef68883ca658f Mon Sep 17 00:00:00 2001 From: mjbudd77 Date: Wed, 29 Dec 2021 21:11:02 -0500 Subject: [PATCH] Added message guard to not spam terminal with mutex warnings when GUI thread is blocking emulation thread from executing. --- src/drivers/Qt/fceuWrapper.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/drivers/Qt/fceuWrapper.cpp b/src/drivers/Qt/fceuWrapper.cpp index 0ff3063e..1098d492 100644 --- a/src/drivers/Qt/fceuWrapper.cpp +++ b/src/drivers/Qt/fceuWrapper.cpp @@ -1307,6 +1307,7 @@ bool fceuWrapperIsLocked(void) int fceuWrapperUpdate( void ) { bool lock_acq; + static bool mutexLockFail = false; // If a request is pending, // sleep to allow request to be serviced. @@ -1321,12 +1322,17 @@ int fceuWrapperUpdate( void ) { 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 ); return -1; } + mutexLockFail = false; emulatorHasMutex = 1; if ( GameInfo )