all repos — mgba @ 070f318c15524a477efaa6755aa84809059411c4

mGBA Game Boy Advance Emulator

Core: Fix unpause callback
Vicki Pfau vi@endrift.com
Sun, 15 Jul 2018 23:27:56 -0700
commit

070f318c15524a477efaa6755aa84809059411c4

parent

d571d8921fed313733803973629780633e3d5774

1 files changed, 12 insertions(+), 6 deletions(-)

jump to
M src/core/thread.csrc/core/thread.c

@@ -201,16 +201,19 @@ MutexLock(&impl->stateMutex);

while (impl->state > THREAD_MAX_RUNNING && impl->state < THREAD_EXITING) { deferred = impl->state; - if (impl->state == THREAD_INTERRUPTING) { + switch (deferred) { + case THREAD_INTERRUPTING: impl->state = THREAD_INTERRUPTED; ConditionWake(&impl->stateCond); - } - - if (impl->state == THREAD_PAUSING) { + break; + case THREAD_PAUSING: impl->state = THREAD_PAUSED; - } - if (impl->state == THREAD_RESETING) { + break; + case THREAD_RESETING: impl->state = THREAD_RUNNING; + break; + default: + break; } if (deferred >= THREAD_MIN_DEFERRED && deferred <= THREAD_MAX_DEFERRED) {

@@ -218,6 +221,9 @@ break;

} deferred = impl->state; + if (deferred == THREAD_INTERRUPTED) { + deferred = impl->savedState; + } while (impl->state >= THREAD_WAITING && impl->state <= THREAD_MAX_WAITING) { ConditionWait(&impl->stateCond, &impl->stateMutex);