all repos — mgba @ c9f74b43afd493dae81fb1714dd721941d4a4edc

mGBA Game Boy Advance Emulator

Make SDL port QUIT events thread-safe
Jeffrey Pfau jeffrey@endrift.com
Sun, 20 Jul 2014 21:32:05 -0700
commit

c9f74b43afd493dae81fb1714dd721941d4a4edc

parent

d48dad27d1609589a1949541b2f5425eba21cafb

1 files changed, 1 insertions(+), 8 deletions(-)

jump to
M src/platform/sdl/sdl-events.csrc/platform/sdl/sdl-events.c

@@ -248,14 +248,7 @@

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