Make SDL port QUIT events thread-safe

This commit is contained in:
Jeffrey Pfau 2014-07-20 21:32:05 -07:00
parent d48dad27d1
commit c9f74b43af
1 changed files with 1 additions and 8 deletions

View File

@ -248,14 +248,7 @@ static void _GBASDLHandleWindowEvent(struct GBAThread* context, struct GBASDLEve
void GBASDLHandleEvent(struct GBAThread* context, struct GBASDLEvents* sdlContext, const union SDL_Event* event) { void GBASDLHandleEvent(struct GBAThread* context, struct GBASDLEvents* sdlContext, const union SDL_Event* event) {
switch (event->type) { switch (event->type) {
case SDL_QUIT: case SDL_QUIT:
// FIXME: this isn't thread-safe GBAThreadEnd(context);
if (context->debugger) {
context->debugger->state = DEBUGGER_EXITING;
}
MutexLock(&context->stateMutex);
context->state = THREAD_EXITING;
ConditionWake(&context->stateCond);
MutexUnlock(&context->stateMutex);
break; break;
#if SDL_VERSION_ATLEAST(2, 0, 0) #if SDL_VERSION_ATLEAST(2, 0, 0)
case SDL_WINDOWEVENT: case SDL_WINDOWEVENT: