GBA Video: Clean up thread proxy a bit
Jeffrey Pfau jeffrey@endrift.com
Fri, 04 Sep 2015 01:48:24 -0700
1 files changed,
10 insertions(+),
3 deletions(-)
jump to
M
src/gba/renderers/thread-proxy.c
→
src/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; }