GBA Thread: Add half-baked ability to disable threading
Jeffrey Pfau jeffrey@endrift.com
Mon, 08 Dec 2014 16:00:08 -0800
2 files changed,
9 insertions(+),
2 deletions(-)
M
src/gba/gba-thread.c
→
src/gba/gba-thread.c
@@ -29,7 +29,7 @@
static void _createTLS(void) { pthread_key_create(&_contextKey, 0); } -#else +#elif _WIN32 static DWORD _contextKey; static INIT_ONCE _contextOnce = INIT_ONCE_STATIC_INIT;@@ -42,6 +42,7 @@ return TRUE;
} #endif +#ifndef DISABLE_THREADING static void _changeState(struct GBAThread* threadContext, enum ThreadState newState, bool broadcast) { MutexLock(&threadContext->stateMutex); threadContext->state = newState;@@ -650,3 +651,4 @@ void GBASyncConsumeAudio(struct GBASync* sync) {
ConditionWake(&sync->audioRequiredCond); MutexUnlock(&sync->audioBufferMutex); } +#endif
M
src/util/threading.h
→
src/util/threading.h
@@ -58,7 +58,7 @@ static inline int ThreadJoin(Thread thread) {
return pthread_join(thread, 0); } -#else +#elif _WIN32 #define _WIN32_WINNT 0x0600 #include <windows.h> #define THREAD_ENTRY DWORD WINAPI@@ -121,6 +121,11 @@ return GetLastError();
} return 0; } +#else +#define DISABLE_THREADING +typedef void* Thread; +typedef void* Mutex; +typedef void* Condition; #endif #endif