Core: Fix unpause callback
Vicki Pfau vi@endrift.com
Sun, 15 Jul 2018 23:27:56 -0700
1 files changed,
12 insertions(+),
6 deletions(-)
jump to
M
src/core/thread.c
→
src/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);