mirror of https://github.com/mgba-emu/mgba.git
GBA Thread: Add half-baked ability to disable threading
This commit is contained in:
parent
a4a7ef4a1b
commit
ed8852bbe0
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue