GBA Thread: Dummy out threading functions, let GBASync* functions still be called
Jeffrey Pfau jeffrey@endrift.com
Mon, 08 Dec 2014 18:49:05 -0800
2 files changed,
50 insertions(+),
2 deletions(-)
M
src/gba/gba-thread.c
→
src/gba/gba-thread.c
@@ -84,6 +84,7 @@ if (!onThread) {
_waitUntilNotState(threadContext, THREAD_PAUSING); } } +#endif static void _changeVideoSync(struct GBASync* sync, bool frameOn) { // Make sure the video thread can process events while the GBA thread is paused@@ -95,6 +96,7 @@ }
MutexUnlock(&sync->videoFrameMutex); } +#ifndef DISABLE_THREADING static THREAD_ENTRY _GBAThreadRun(void* context) { #ifdef USE_PTHREADS pthread_once(&_contextOnce, _createTLS);@@ -534,7 +536,7 @@ struct GBAThread* GBAThreadGetContext(void) {
pthread_once(&_contextOnce, _createTLS); return pthread_getspecific(_contextKey); } -#else +#elif _WIN32 struct GBAThread* GBAThreadGetContext(void) { InitOnceExecuteOnce(&_contextOnce, _createTLS, NULL, 0); return TlsGetValue(_contextKey);@@ -552,6 +554,12 @@ png_infop info = PNGWriteHeader(png, VIDEO_HORIZONTAL_PIXELS, VIDEO_VERTICAL_PIXELS);
PNGWritePixels(png, VIDEO_HORIZONTAL_PIXELS, VIDEO_VERTICAL_PIXELS, stride, pixels); PNGWriteClose(png, info); vf->close(vf); +} +#endif + +#else +struct GBAThread* GBAThreadGetContext(void) { + return 0; } #endif@@ -651,4 +659,3 @@ void GBASyncConsumeAudio(struct GBASync* sync) {
ConditionWake(&sync->audioRequiredCond); MutexUnlock(&sync->audioBufferMutex); } -#endif
M
src/util/threading.h
→
src/util/threading.h
@@ -126,6 +126,47 @@ #define DISABLE_THREADING
typedef void* Thread; typedef void* Mutex; 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