Core: Fix threading improperly setting paused state while interrupted

This commit is contained in:
Vicki Pfau 2020-11-14 02:29:39 -08:00
parent 01ed3f2990
commit 9a0561e9c2
2 changed files with 5 additions and 1 deletions

View File

@ -48,6 +48,7 @@ Other fixes:
- All: Improve export headers (fixes mgba.io/i/1738)
- CMake: Fix build with downstream minizip that exports incompatible symbols
- Core: Ensure ELF regions can be written before trying
- Core: Fix threading improperly setting paused state while interrupted
- Debugger: Don't skip undefined instructions when debugger attached
- Debugger: Close trace log when done tracing
- FFmpeg: Fix some small memory leaks

View File

@ -568,7 +568,10 @@ void mCoreThreadTogglePause(struct mCoreThread* threadContext) {
void mCoreThreadPauseFromThread(struct mCoreThread* threadContext) {
bool frameOn = true;
MutexLock(&threadContext->impl->stateMutex);
if (threadContext->impl->state == THREAD_RUNNING || (threadContext->impl->interruptDepth && threadContext->impl->savedState == THREAD_RUNNING)) {
if (threadContext->impl->interruptDepth && threadContext->impl->savedState == THREAD_RUNNING) {
threadContext->impl->savedState = THREAD_PAUSING;
frameOn = false;
} else if (threadContext->impl->state == THREAD_RUNNING) {
threadContext->impl->state = THREAD_PAUSING;
frameOn = false;
}