mirror of https://github.com/mgba-emu/mgba.git
Core: Fix interrupting a thread while on the thread (fixes #692)
This commit is contained in:
parent
23a346e8ce
commit
dc5c59d4db
1
CHANGES
1
CHANGES
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue