Core: Fix thread unsafety issue when dispatching code to a thread

This commit is contained in:
Vicki Pfau 2020-11-14 16:42:51 -08:00
parent 93d3eaae1a
commit a268eb7175
2 changed files with 4 additions and 0 deletions

View File

@ -4,6 +4,7 @@ Emulation fixes:
- GBA Memory: Mark Famicom Mini games 22 through 28 as non-mirroring
Other fixes:
- CMake: Fix build with downstream minizip that exports incompatible symbols
- Core: Fix thread unsafety issue when dispatching code to a thread
- Debugger: Close trace log when done tracing
- Qt: Fix running proxied video if it gets pushed to the main thread

View File

@ -260,7 +260,10 @@ static THREAD_ENTRY _mCoreThreadRun(void* context) {
if (threadContext->run) {
threadContext->run(threadContext);
}
MutexLock(&threadContext->impl->stateMutex);
threadContext->impl->state = threadContext->impl->savedState;
ConditionWake(&threadContext->impl->stateCond);
MutexUnlock(&threadContext->impl->stateMutex);
break;
case THREAD_RESETING:
core->reset(core);