mirror of https://github.com/mgba-emu/mgba.git
GBA Thread: Dummy out threading functions, let GBASync* functions still be called
This commit is contained in:
parent
2aae3dc660
commit
461eb3bae0
|
@ -84,6 +84,7 @@ static void _pauseThread(struct GBAThread* threadContext, bool onThread) {
|
||||||
_waitUntilNotState(threadContext, THREAD_PAUSING);
|
_waitUntilNotState(threadContext, THREAD_PAUSING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void _changeVideoSync(struct GBASync* sync, bool frameOn) {
|
static void _changeVideoSync(struct GBASync* sync, bool frameOn) {
|
||||||
// Make sure the video thread can process events while the GBA thread is paused
|
// Make sure the video thread can process events while the GBA thread is paused
|
||||||
|
@ -95,6 +96,7 @@ static void _changeVideoSync(struct GBASync* sync, bool frameOn) {
|
||||||
MutexUnlock(&sync->videoFrameMutex);
|
MutexUnlock(&sync->videoFrameMutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef DISABLE_THREADING
|
||||||
static THREAD_ENTRY _GBAThreadRun(void* context) {
|
static THREAD_ENTRY _GBAThreadRun(void* context) {
|
||||||
#ifdef USE_PTHREADS
|
#ifdef USE_PTHREADS
|
||||||
pthread_once(&_contextOnce, _createTLS);
|
pthread_once(&_contextOnce, _createTLS);
|
||||||
|
@ -534,7 +536,7 @@ struct GBAThread* GBAThreadGetContext(void) {
|
||||||
pthread_once(&_contextOnce, _createTLS);
|
pthread_once(&_contextOnce, _createTLS);
|
||||||
return pthread_getspecific(_contextKey);
|
return pthread_getspecific(_contextKey);
|
||||||
}
|
}
|
||||||
#else
|
#elif _WIN32
|
||||||
struct GBAThread* GBAThreadGetContext(void) {
|
struct GBAThread* GBAThreadGetContext(void) {
|
||||||
InitOnceExecuteOnce(&_contextOnce, _createTLS, NULL, 0);
|
InitOnceExecuteOnce(&_contextOnce, _createTLS, NULL, 0);
|
||||||
return TlsGetValue(_contextKey);
|
return TlsGetValue(_contextKey);
|
||||||
|
@ -555,6 +557,12 @@ void GBAThreadTakeScreenshot(struct GBAThread* threadContext) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#else
|
||||||
|
struct GBAThread* GBAThreadGetContext(void) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void GBASyncPostFrame(struct GBASync* sync) {
|
void GBASyncPostFrame(struct GBASync* sync) {
|
||||||
if (!sync) {
|
if (!sync) {
|
||||||
return;
|
return;
|
||||||
|
@ -651,4 +659,3 @@ void GBASyncConsumeAudio(struct GBASync* sync) {
|
||||||
ConditionWake(&sync->audioRequiredCond);
|
ConditionWake(&sync->audioRequiredCond);
|
||||||
MutexUnlock(&sync->audioBufferMutex);
|
MutexUnlock(&sync->audioBufferMutex);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
|
@ -126,6 +126,47 @@ static inline int ThreadJoin(Thread thread) {
|
||||||
typedef void* Thread;
|
typedef void* Thread;
|
||||||
typedef void* Mutex;
|
typedef void* Mutex;
|
||||||
typedef void* Condition;
|
typedef void* Condition;
|
||||||
|
|
||||||
|
static inline int MutexInit(Mutex* mutex) {
|
||||||
|
UNUSED(mutex);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int MutexDeinit(Mutex* mutex) {
|
||||||
|
UNUSED(mutex);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int MutexLock(Mutex* mutex) {
|
||||||
|
UNUSED(mutex);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int MutexUnlock(Mutex* mutex) {
|
||||||
|
UNUSED(mutex);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int ConditionInit(Condition* cond) {
|
||||||
|
UNUSED(cond);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int ConditionDeinit(Condition* cond) {
|
||||||
|
UNUSED(cond);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int ConditionWait(Condition* cond, Mutex* mutex) {
|
||||||
|
UNUSED(cond);
|
||||||
|
UNUSED(mutex);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int ConditionWake(Condition* cond) {
|
||||||
|
UNUSED(cond);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue