GBA Thread: Properly use _WIN32 to increase portability
Jeffrey Pfau jeffrey@endrift.com
Sun, 05 Jul 2015 12:55:53 -0700
1 files changed,
7 insertions(+),
3 deletions(-)
jump to
M
src/gba/supervisor/thread.c
→
src/gba/supervisor/thread.c
@@ -99,7 +99,7 @@
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 @@ gba.stream = threadContext->stream;
gba.idleOptimization = threadContext->idleOptimization; #ifdef USE_PTHREADS pthread_setspecific(_contextKey, threadContext); -#else +#elif _WIN32 TlsSetValue(_contextKey, threadContext); #endif@@ -410,7 +410,7 @@ ConditionInit(&threadContext->sync.audioRequiredCond);
threadContext->interruptDepth = 0; -#ifndef _WIN32 +#ifdef USE_PTHREADS sigset_t signals; sigemptyset(&signals); sigaddset(&signals, SIGINT);@@ -721,6 +721,10 @@ #elif _WIN32
struct GBAThread* GBAThreadGetContext(void) { InitOnceExecuteOnce(&_contextOnce, _createTLS, NULL, 0); return TlsGetValue(_contextKey); +} +#else +struct GBAThread* GBAThreadGetContext(void) { + return 0; } #endif