all repos — mgba @ dc5c59d4dbe157bb1c6fe1e00c0893815723a16b

mGBA Game Boy Advance Emulator

Core: Fix interrupting a thread while on the thread (fixes #692)
Vicki Pfau vi@endrift.com
Wed, 28 Jun 2017 13:07:39 -0700
commit

dc5c59d4dbe157bb1c6fe1e00c0893815723a16b

parent

23a346e8ce24b26b1a5bd980a744bf87f56b99a4

2 files changed, 5 insertions(+), 1 deletions(-)

jump to
M CHANGESCHANGES

@@ -73,6 +73,7 @@ - GBA Savedata: Update and fix Sharkport importing (fixes mgba.io/i/658)

- OpenGL: Fix some shaders causing offset graphics - Qt: Fix game unpausing after frame advancing and refocusing - GB Timer: Fix sub-M-cycle DIV reset timing and edge triggering + - Core: Fix interrupting a thread while on the thread (fixes mgba.io/i/692) Misc: - SDL: Remove scancode key input - GBA Video: Clean up unused timers
M src/core/thread.csrc/core/thread.c

@@ -401,11 +401,14 @@ }

MutexLock(&threadContext->stateMutex); ++threadContext->interruptDepth; if (threadContext->interruptDepth > 1 || !mCoreThreadIsActive(threadContext)) { + if (threadContext->state == THREAD_INTERRUPTING) { + threadContext->state = THREAD_INTERRUPTED; + } MutexUnlock(&threadContext->stateMutex); return; } threadContext->savedState = threadContext->state; - threadContext->state = THREAD_INTERRUPTING; + threadContext->state = THREAD_INTERRUPTED; ConditionWake(&threadContext->stateCond); MutexUnlock(&threadContext->stateMutex); }