From 32cb7bfcdca87d8dc95660ce53855356130a11d7 Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Sun, 5 Jul 2015 12:55:53 -0700 Subject: [PATCH] GBA Thread: Properly use _WIN32 to increase portability --- src/gba/supervisor/thread.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/gba/supervisor/thread.c b/src/gba/supervisor/thread.c index 587c6c9a3..e617b1afd 100644 --- a/src/gba/supervisor/thread.c +++ b/src/gba/supervisor/thread.c @@ -99,7 +99,7 @@ static void _pauseThread(struct GBAThread* threadContext, bool onThread) { static THREAD_ENTRY _GBAThreadRun(void* context) { #ifdef USE_PTHREADS pthread_once(&_contextOnce, _createTLS); -#else +#elif _WIN32 InitOnceExecuteOnce(&_contextOnce, _createTLS, NULL, 0); #endif @@ -132,7 +132,7 @@ static THREAD_ENTRY _GBAThreadRun(void* context) { gba.idleOptimization = threadContext->idleOptimization; #ifdef USE_PTHREADS pthread_setspecific(_contextKey, threadContext); -#else +#elif _WIN32 TlsSetValue(_contextKey, threadContext); #endif @@ -410,7 +410,7 @@ bool GBAThreadStart(struct GBAThread* threadContext) { threadContext->interruptDepth = 0; -#ifndef _WIN32 +#ifdef USE_PTHREADS sigset_t signals; sigemptyset(&signals); sigaddset(&signals, SIGINT); @@ -722,6 +722,10 @@ struct GBAThread* GBAThreadGetContext(void) { InitOnceExecuteOnce(&_contextOnce, _createTLS, NULL, 0); return TlsGetValue(_contextKey); } +#else +struct GBAThread* GBAThreadGetContext(void) { + return 0; +} #endif #ifdef USE_PNG