all repos — mgba @ d98e30f984e6bdcec1581783bddb744f3c4f8a14

mGBA Game Boy Advance Emulator

Core: Fix race condition initializing thread proxy
Vicki Pfau vi@endrift.com
Fri, 31 Jan 2020 18:06:18 -0800
commit

d98e30f984e6bdcec1581783bddb744f3c4f8a14

parent

313c8a1d7fa18fe6b2f13822c68841d927c26363

2 files changed, 6 insertions(+), 2 deletions(-)

jump to
M CHANGESCHANGES

@@ -7,6 +7,7 @@ - GBA Video: Fix OAM not invalidating after reset (fixes mgba.io/i/1630)

- GBA Video: Fix backdrop blending on lines without sprites (fixes mgba.io/i/1647) - GBA Video: Fix OpenGL sprite flag priority Other fixes: + - Core: Fix race condition initializing thread proxy - Qt: Only dynamically reset video scale if a game is running - Qt: Fix race condition with proxied video events - Qt: Fix color selection in asset view (fixes mgba.io/i/1648)
M src/feature/thread-proxy.csrc/feature/thread-proxy.c

@@ -137,8 +137,10 @@ static void _postEvent(struct mVideoLogger* logger, enum mVideoLoggerEvent event) {

struct mVideoThreadProxy* proxyRenderer = (struct mVideoThreadProxy*) logger; MutexLock(&proxyRenderer->mutex); proxyRenderer->event = event; - ConditionWake(&proxyRenderer->toThreadCond); - ConditionWait(&proxyRenderer->fromThreadCond, &proxyRenderer->mutex); + while (proxyRenderer->event) { + ConditionWake(&proxyRenderer->toThreadCond); + ConditionWait(&proxyRenderer->fromThreadCond, &proxyRenderer->mutex); + } MutexUnlock(&proxyRenderer->mutex); }

@@ -179,6 +181,7 @@ struct mVideoThreadProxy* proxyRenderer = logger;

ThreadSetName("Proxy Renderer Thread"); MutexLock(&proxyRenderer->mutex); + ConditionWake(&proxyRenderer->fromThreadCond); while (proxyRenderer->threadState != PROXY_THREAD_STOPPED) { ConditionWait(&proxyRenderer->toThreadCond, &proxyRenderer->mutex); if (proxyRenderer->threadState == PROXY_THREAD_STOPPED) {