From 3b29ba1aa29e9c303385b090aaaa6cc2733ad367 Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Wed, 3 Jun 2015 20:37:45 -0700 Subject: [PATCH] Util: Allow disabling the threading code entirely --- CHANGES | 1 + src/gba/supervisor/thread.c | 2 +- src/util/threading.h | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 33cf9eaa0..f36a0637c 100644 --- a/CHANGES +++ b/CHANGES @@ -58,6 +58,7 @@ Misc: - Qt: Only hide cursor in full screen - Perf: Ability to load savestates immediately on launch - Qt: Replace pause-after-frame mutex with an atomic + - Util: Allow disabling the threading code entirely 0.2.1: (2015-05-13) Bugfixes: diff --git a/src/gba/supervisor/thread.c b/src/gba/supervisor/thread.c index 8eefc3cac..214734391 100644 --- a/src/gba/supervisor/thread.c +++ b/src/gba/supervisor/thread.c @@ -25,6 +25,7 @@ static const float _defaultFPSTarget = 60.f; +#ifndef DISABLE_THREADING #ifdef USE_PTHREADS static pthread_key_t _contextKey; static pthread_once_t _contextOnce = PTHREAD_ONCE_INIT; @@ -45,7 +46,6 @@ static BOOL CALLBACK _createTLS(PINIT_ONCE once, PVOID param, PVOID* context) { } #endif -#ifndef DISABLE_THREADING static void _changeState(struct GBAThread* threadContext, enum ThreadState newState, bool broadcast) { MutexLock(&threadContext->stateMutex); threadContext->state = newState; diff --git a/src/util/threading.h b/src/util/threading.h index 8d0837bbb..5d253801e 100644 --- a/src/util/threading.h +++ b/src/util/threading.h @@ -8,6 +8,7 @@ #include "util/common.h" +#ifndef DISABLE_THREADING #ifdef USE_PTHREADS #include #include @@ -144,6 +145,9 @@ static inline int ThreadJoin(Thread thread) { } #else #define DISABLE_THREADING +#endif +#endif +#ifdef DISABLE_THREADING typedef void* Thread; typedef void* Mutex; typedef void* Condition;