GBA Thread: Fix GBARunOnThread to not trample old state
Jeffrey Pfau jeffrey@endrift.com
Sun, 31 May 2015 21:44:34 -0700
1 files changed,
2 insertions(+),
1 deletions(-)
jump to
M
src/gba/supervisor/thread.c
→
src/gba/supervisor/thread.c
@@ -279,7 +279,7 @@ if (threadContext->state == THREAD_RUN_ON) {
if (threadContext->run) { threadContext->run(threadContext); } - threadContext->state = THREAD_RUNNING; + threadContext->state = threadContext->savedState; ConditionWake(&threadContext->stateCond); } if (threadContext->state == THREAD_RESETING) {@@ -610,6 +610,7 @@ void GBARunOnThread(struct GBAThread* threadContext, void (*run)(struct GBAThread*)) {
MutexLock(&threadContext->stateMutex); threadContext->run = run; _waitOnInterrupt(threadContext); + threadContext->savedState = threadContext->state; threadContext->state = THREAD_RUN_ON; threadContext->gba->cpu->nextEvent = 0; ConditionWake(&threadContext->stateCond);