all repos — mgba @ ed8852bbe089ec33bd0b5b4737ecf27b8a7b8160

mGBA Game Boy Advance Emulator

GBA Thread: Add half-baked ability to disable threading
Jeffrey Pfau jeffrey@endrift.com
Mon, 08 Dec 2014 16:00:08 -0800
commit

ed8852bbe089ec33bd0b5b4737ecf27b8a7b8160

parent

a4a7ef4a1bf7a9b7dae78bf835fe3a3f312c9786

2 files changed, 9 insertions(+), 2 deletions(-)

jump to
M src/gba/gba-thread.csrc/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.hsrc/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