Fixed some missing THREADED_65C02 #defines

* allows single-threaded operation
This commit is contained in:
Rob McMullen 2018-01-15 22:39:25 -08:00
parent 01d41f5b9d
commit f657df18a2

View File

@ -59,6 +59,7 @@
// Debug and misc. defines // Debug and misc. defines
#define THREADED_65C02 #define THREADED_65C02
#undef THREADED_65C02
#define CPU_THREAD_OVERFLOW_COMPENSATION #define CPU_THREAD_OVERFLOW_COMPENSATION
#define DEBUG_LC #define DEBUG_LC
//#define CPU_CLOCK_CHECKING //#define CPU_CLOCK_CHECKING
@ -573,7 +574,6 @@ WriteLog("Main: SDL_SemWait(mainSem);\n");
if (!pauseMode) if (!pauseMode)
// Should lock until CPU thread is waiting... // Should lock until CPU thread is waiting...
SDL_SemWait(mainSem); SDL_SemWait(mainSem);
#endif
WriteLog("Main: SDL_CondSignal(cpuCond);\n"); WriteLog("Main: SDL_CondSignal(cpuCond);\n");
SDL_CondSignal(cpuCond);//thread is probably asleep, so wake it up SDL_CondSignal(cpuCond);//thread is probably asleep, so wake it up
@ -582,6 +582,7 @@ WriteLog("Main: SDL_WaitThread(cpuThread, NULL);\n");
WriteLog("Main: SDL_DestroyCond(cpuCond);\n"); WriteLog("Main: SDL_DestroyCond(cpuCond);\n");
SDL_DestroyCond(cpuCond); SDL_DestroyCond(cpuCond);
SDL_DestroySemaphore(mainSem); SDL_DestroySemaphore(mainSem);
#endif
// Autosave state here, if requested... // Autosave state here, if requested...
if (settings.autoStateSaving) if (settings.autoStateSaving)
@ -969,14 +970,18 @@ static void FrameCallback(void)
if (GUI::powerOnState) if (GUI::powerOnState)
{ {
pauseMode = false; pauseMode = false;
#ifdef THREADED_65C02
// Unlock the CPU thread... // Unlock the CPU thread...
SDL_SemPost(mainSem); SDL_SemPost(mainSem);
#endif
} }
else else
{ {
pauseMode = true; pauseMode = true;
#ifdef THREADED_65C02
// Should lock until CPU thread is waiting... // Should lock until CPU thread is waiting...
SDL_SemWait(mainSem); SDL_SemWait(mainSem);
#endif
ResetApple2State(); ResetApple2State();
} }