Disabled Qt/SDL mutex lock debug code.

This commit is contained in:
mjbudd77 2021-12-31 07:01:57 -05:00
parent 31a859b6df
commit b4734ac45f
1 changed files with 16 additions and 16 deletions

View File

@ -1219,23 +1219,27 @@ static void DoFun(int frameskip, int periodic_saves)
} }
static std::string lockFile; static std::string lockFile;
static bool debugMutexLock = false;
void fceuWrapperLock(const char *filename, int line, const char *func) void fceuWrapperLock(const char *filename, int line, const char *func)
{ {
char txt[32];
fceuWrapperLock(); fceuWrapperLock();
if ( mutexLocks > 1 ) if ( debugMutexLock )
{ {
printf("Recursive Lock:%i\n", mutexLocks ); char txt[32];
printf("Already Locked By: %s\n", lockFile.c_str() );
printf("Requested By: %s:%i - %s\n", filename, line, func ); if ( mutexLocks > 1 )
{
printf("Recursive Lock:%i\n", mutexLocks );
printf("Already Locked By: %s\n", lockFile.c_str() );
printf("Requested By: %s:%i - %s\n", filename, line, func );
}
sprintf( txt, ":%i - ", line );
lockFile.assign(filename);
lockFile.append(txt);
lockFile.append(func);
} }
sprintf( txt, ":%i - ", line );
lockFile.assign(filename);
lockFile.append(txt);
lockFile.append(func);
} }
void fceuWrapperLock(void) void fceuWrapperLock(void)
@ -1246,22 +1250,18 @@ void fceuWrapperLock(void)
consoleWindow->mutex->lock(); consoleWindow->mutex->lock();
} }
mutexPending--; mutexPending--;
if ( mutexLocks > 0 )
{
printf("Recursive Lock:%i\n", mutexLocks );
}
mutexLocks++; mutexLocks++;
} }
bool fceuWrapperTryLock(const char *filename, int line, const char *func, int timeout) bool fceuWrapperTryLock(const char *filename, int line, const char *func, int timeout)
{ {
char txt[32];
bool lockAcq = false; bool lockAcq = false;
lockAcq = fceuWrapperTryLock( timeout ); lockAcq = fceuWrapperTryLock( timeout );
if ( lockAcq ) if ( lockAcq && debugMutexLock)
{ {
char txt[32];
sprintf( txt, ":%i - ", line ); sprintf( txt, ":%i - ", line );
lockFile.assign(filename); lockFile.assign(filename);
lockFile.append(txt); lockFile.append(txt);