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 89937d62b0
commit 1c2ec714e1
2 changed files with 4 additions and 0 deletions

View File

@ -49,6 +49,7 @@ Other fixes:
- 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
- Core: Fix thread unsafety issue when dispatching code to a thread
- Debugger: Don't skip undefined instructions when debugger attached
- Debugger: Close trace log when done tracing
- FFmpeg: Fix some small memory leaks

View File

@ -267,7 +267,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);