Util: Add THREAD_EXIT macro

This commit is contained in:
Vicki Pfau 2023-05-09 22:21:55 -07:00
parent 7d6a8a86a8
commit bb6613888a
11 changed files with 11 additions and 3 deletions

View File

@ -12,6 +12,7 @@
#include <malloc.h>
#define THREAD_ENTRY void
#define THREAD_EXIT(RES) return
typedef ThreadFunc ThreadEntry;
typedef LightLock Mutex;

View File

@ -20,6 +20,7 @@ CXX_GUARD_START
#define THREAD_ENTRY void*
typedef THREAD_ENTRY (*ThreadEntry)(void*);
#define THREAD_EXIT(RES) return RES
typedef pthread_t Thread;
typedef pthread_mutex_t Mutex;

View File

@ -17,6 +17,7 @@ typedef struct {
} Condition;
#define THREAD_ENTRY int
typedef THREAD_ENTRY (*ThreadEntry)(void*);
#define THREAD_EXIT(RES) return RES
static inline int MutexInit(Mutex* mutex) {
Mutex id = sceKernelCreateMutex("mutex", 0, 0, 0);

View File

@ -11,6 +11,7 @@
#include <switch.h>
#define THREAD_ENTRY void
#define THREAD_EXIT(RES) return
typedef ThreadFunc ThreadEntry;
typedef CondVar Condition;

View File

@ -12,6 +12,7 @@
#include <windows.h>
#define THREAD_ENTRY DWORD WINAPI
typedef THREAD_ENTRY ThreadEntry(LPVOID);
#define THREAD_EXIT(RES) return RES
typedef HANDLE Thread;
typedef CRITICAL_SECTION Mutex;

View File

@ -176,7 +176,7 @@ THREAD_ENTRY _rewindThread(void* context) {
rewindContext->ready = false;
}
MutexUnlock(&rewindContext->mutex);
return 0;
THREAD_EXIT(0);
}
#endif

View File

@ -159,6 +159,7 @@ static THREAD_ENTRY _promptThread(void* context) {
ConditionWait(&elbe->promptWrite, &elbe->promptMutex);
}
MutexUnlock(&elbe->promptMutex);
THREAD_EXIT(0);
}
static int CLIDebuggerEditLinePoll(struct CLIDebuggerBackend* be, int32_t timeoutMs) {

View File

@ -841,5 +841,6 @@ THREAD_ENTRY mGUIAutosaveThread(void* context) {
}
}
MutexUnlock(&autosave->mutex);
THREAD_EXIT(0);
}
#endif

View File

@ -207,7 +207,7 @@ static THREAD_ENTRY _proxyThread(void* logger) {
}
}
MutexUnlock(&proxyRenderer->mutex);
return 0;
THREAD_EXIT(0);
}
#endif

View File

@ -129,7 +129,7 @@ static THREAD_ENTRY _audioThread(void* context) {
sceAudioOutOutput(audioPort, buffer);
}
sceAudioOutReleasePort(audioPort);
return 0;
THREAD_EXIT(0);
}
static void _sampleRotation(struct mRotationSource* source) {

View File

@ -1365,6 +1365,7 @@ static THREAD_ENTRY CInemaJob(void* context) {
CIflush(&stream.err, stderr);
StringListDeinit(&stream.err.lines);
StringListDeinit(&stream.err.partial);
THREAD_EXIT(0);
}
void _log(struct mLogger* log, int category, enum mLogLevel level, const char* format, va_list args) {