all repos — mgba @ 1c2ec714e1167532516326804bdfa9d741318baf

mGBA Game Boy Advance Emulator

Core: Fix thread unsafety issue when dispatching code to a thread
Vicki Pfau vi@endrift.com
Sat, 14 Nov 2020 16:42:51 -0800
commit

1c2ec714e1167532516326804bdfa9d741318baf

parent

89937d62b0055fbb22ce60e15e5e79fad7c05b90

2 files changed, 4 insertions(+), 0 deletions(-)

jump to
M CHANGESCHANGES

@@ -49,6 +49,7 @@ - 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 + - 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
M src/core/thread.csrc/core/thread.c

@@ -267,7 +267,10 @@ case THREAD_RUN_ON:

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);