Permalink
Browse files
Core: Fix interrupting a thread while on the thread (fixes #692)
- Loading branch information...
Showing
with
5 additions
and
1 deletion.
-
+1
−0
CHANGES
-
+4
−1
src/core/thread.c
|
|
@@ -73,6 +73,7 @@ Bugfixes: |
|
|
- 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
|
|
|
|
|
|
@@ -401,11 +401,14 @@ void mCoreThreadInterruptFromThread(struct mCoreThread* threadContext) { |
|
|
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);
|
|
|
}
|
|
|
|
0 comments on commit
dc5c59d