GBA Thread: Add half-baked ability to disable threading

This commit is contained in:
Jeffrey Pfau 2014-12-08 16:00:08 -08:00
parent a4a7ef4a1b
commit ed8852bbe0
2 changed files with 9 additions and 2 deletions

View File

@ -29,7 +29,7 @@ static pthread_once_t _contextOnce = PTHREAD_ONCE_INIT;
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 @@ 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;
@ -650,3 +651,4 @@ void GBASyncConsumeAudio(struct GBASync* sync) {
ConditionWake(&sync->audioRequiredCond);
MutexUnlock(&sync->audioBufferMutex);
}
#endif

View File

@ -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 @@ static inline int ThreadJoin(Thread thread) {
}
return 0;
}
#else
#define DISABLE_THREADING
typedef void* Thread;
typedef void* Mutex;
typedef void* Condition;
#endif
#endif