mirror of https://github.com/mgba-emu/mgba.git
Util: Add THREAD_EXIT macro
This commit is contained in:
parent
7d6a8a86a8
commit
bb6613888a
|
@ -12,6 +12,7 @@
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
|
|
||||||
#define THREAD_ENTRY void
|
#define THREAD_ENTRY void
|
||||||
|
#define THREAD_EXIT(RES) return
|
||||||
typedef ThreadFunc ThreadEntry;
|
typedef ThreadFunc ThreadEntry;
|
||||||
|
|
||||||
typedef LightLock Mutex;
|
typedef LightLock Mutex;
|
||||||
|
|
|
@ -20,6 +20,7 @@ CXX_GUARD_START
|
||||||
|
|
||||||
#define THREAD_ENTRY void*
|
#define THREAD_ENTRY void*
|
||||||
typedef THREAD_ENTRY (*ThreadEntry)(void*);
|
typedef THREAD_ENTRY (*ThreadEntry)(void*);
|
||||||
|
#define THREAD_EXIT(RES) return RES
|
||||||
|
|
||||||
typedef pthread_t Thread;
|
typedef pthread_t Thread;
|
||||||
typedef pthread_mutex_t Mutex;
|
typedef pthread_mutex_t Mutex;
|
||||||
|
|
|
@ -17,6 +17,7 @@ typedef struct {
|
||||||
} Condition;
|
} Condition;
|
||||||
#define THREAD_ENTRY int
|
#define THREAD_ENTRY int
|
||||||
typedef THREAD_ENTRY (*ThreadEntry)(void*);
|
typedef THREAD_ENTRY (*ThreadEntry)(void*);
|
||||||
|
#define THREAD_EXIT(RES) return RES
|
||||||
|
|
||||||
static inline int MutexInit(Mutex* mutex) {
|
static inline int MutexInit(Mutex* mutex) {
|
||||||
Mutex id = sceKernelCreateMutex("mutex", 0, 0, 0);
|
Mutex id = sceKernelCreateMutex("mutex", 0, 0, 0);
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
|
|
||||||
#define THREAD_ENTRY void
|
#define THREAD_ENTRY void
|
||||||
|
#define THREAD_EXIT(RES) return
|
||||||
typedef ThreadFunc ThreadEntry;
|
typedef ThreadFunc ThreadEntry;
|
||||||
typedef CondVar Condition;
|
typedef CondVar Condition;
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#define THREAD_ENTRY DWORD WINAPI
|
#define THREAD_ENTRY DWORD WINAPI
|
||||||
typedef THREAD_ENTRY ThreadEntry(LPVOID);
|
typedef THREAD_ENTRY ThreadEntry(LPVOID);
|
||||||
|
#define THREAD_EXIT(RES) return RES
|
||||||
|
|
||||||
typedef HANDLE Thread;
|
typedef HANDLE Thread;
|
||||||
typedef CRITICAL_SECTION Mutex;
|
typedef CRITICAL_SECTION Mutex;
|
||||||
|
|
|
@ -176,7 +176,7 @@ THREAD_ENTRY _rewindThread(void* context) {
|
||||||
rewindContext->ready = false;
|
rewindContext->ready = false;
|
||||||
}
|
}
|
||||||
MutexUnlock(&rewindContext->mutex);
|
MutexUnlock(&rewindContext->mutex);
|
||||||
return 0;
|
THREAD_EXIT(0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -159,6 +159,7 @@ static THREAD_ENTRY _promptThread(void* context) {
|
||||||
ConditionWait(&elbe->promptWrite, &elbe->promptMutex);
|
ConditionWait(&elbe->promptWrite, &elbe->promptMutex);
|
||||||
}
|
}
|
||||||
MutexUnlock(&elbe->promptMutex);
|
MutexUnlock(&elbe->promptMutex);
|
||||||
|
THREAD_EXIT(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int CLIDebuggerEditLinePoll(struct CLIDebuggerBackend* be, int32_t timeoutMs) {
|
static int CLIDebuggerEditLinePoll(struct CLIDebuggerBackend* be, int32_t timeoutMs) {
|
||||||
|
|
|
@ -841,5 +841,6 @@ THREAD_ENTRY mGUIAutosaveThread(void* context) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MutexUnlock(&autosave->mutex);
|
MutexUnlock(&autosave->mutex);
|
||||||
|
THREAD_EXIT(0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -207,7 +207,7 @@ static THREAD_ENTRY _proxyThread(void* logger) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MutexUnlock(&proxyRenderer->mutex);
|
MutexUnlock(&proxyRenderer->mutex);
|
||||||
return 0;
|
THREAD_EXIT(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -129,7 +129,7 @@ static THREAD_ENTRY _audioThread(void* context) {
|
||||||
sceAudioOutOutput(audioPort, buffer);
|
sceAudioOutOutput(audioPort, buffer);
|
||||||
}
|
}
|
||||||
sceAudioOutReleasePort(audioPort);
|
sceAudioOutReleasePort(audioPort);
|
||||||
return 0;
|
THREAD_EXIT(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _sampleRotation(struct mRotationSource* source) {
|
static void _sampleRotation(struct mRotationSource* source) {
|
||||||
|
|
|
@ -1365,6 +1365,7 @@ static THREAD_ENTRY CInemaJob(void* context) {
|
||||||
CIflush(&stream.err, stderr);
|
CIflush(&stream.err, stderr);
|
||||||
StringListDeinit(&stream.err.lines);
|
StringListDeinit(&stream.err.lines);
|
||||||
StringListDeinit(&stream.err.partial);
|
StringListDeinit(&stream.err.partial);
|
||||||
|
THREAD_EXIT(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _log(struct mLogger* log, int category, enum mLogLevel level, const char* format, va_list args) {
|
void _log(struct mLogger* log, int category, enum mLogLevel level, const char* format, va_list args) {
|
||||||
|
|
Loading…
Reference in New Issue