all repos — mgba @ 5bed376e5cbc412db156b5046099b560a244d8f3

mGBA Game Boy Advance Emulator

GBA Video: Clean up thread proxy a bit
Jeffrey Pfau jeffrey@endrift.com
Fri, 04 Sep 2015 01:48:24 -0700
commit

5bed376e5cbc412db156b5046099b560a244d8f3

parent

e1ffc685827fc0f4068b745533457b43f5a1a1e9

1 files changed, 10 insertions(+), 3 deletions(-)

jump to
M src/gba/renderers/thread-proxy.csrc/gba/renderers/thread-proxy.c

@@ -69,7 +69,7 @@ struct GBAVideoThreadProxyRenderer* proxyRenderer = (struct GBAVideoThreadProxyRenderer*) renderer;

ConditionInit(&proxyRenderer->fromThreadCond); ConditionInit(&proxyRenderer->toThreadCond); MutexInit(&proxyRenderer->mutex); - RingFIFOInit(&proxyRenderer->dirtyQueue, 0x200000, 0x1000); + RingFIFOInit(&proxyRenderer->dirtyQueue, 0x40000, 0x1000); proxyRenderer->threadState = PROXY_THREAD_STOPPED; proxyRenderer->vramProxy = anonymousMemoryMap(SIZE_VRAM);

@@ -299,16 +299,23 @@ // This is only here to ensure the queue gets flushed

break; default: // FIFO was corrupted - abort(); + proxyRenderer->threadState = PROXY_THREAD_STOPPED; break; } } MutexLock(&proxyRenderer->mutex); - proxyRenderer->threadState = PROXY_THREAD_IDLE; ConditionWake(&proxyRenderer->fromThreadCond); + if (proxyRenderer->threadState != PROXY_THREAD_STOPPED) { + proxyRenderer->threadState = PROXY_THREAD_IDLE; + } else { + break; + } } MutexUnlock(&proxyRenderer->mutex); +#ifdef _3DS + svcExitThread(); +#endif return 0; }