From c5b686fce2cb35dba85b1575df98a2adf68ed546 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Sun, 26 May 2019 14:26:35 -0700 Subject: [PATCH] Switch: Fix threading-related crash on second launch --- CHANGES | 4 ++++ include/mgba-util/platform/switch/threading.h | 8 +++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index d80b40b96..71f2c8511 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +0.7.3: (Future) +Other fixes: + - Switch: Fix threading-related crash on second launch + 0.7.2: (2019-05-25) Emulation fixes: - GB: Fix HALT when IE and IF unused bits are set (fixes mgba.io/i/1349) diff --git a/include/mgba-util/platform/switch/threading.h b/include/mgba-util/platform/switch/threading.h index 7003317b3..a358bd69b 100644 --- a/include/mgba-util/platform/switch/threading.h +++ b/include/mgba-util/platform/switch/threading.h @@ -14,6 +14,8 @@ typedef ThreadFunc ThreadEntry; typedef CondVar Condition; +#define ThreadJoin(T) ThreadJoinPtr(&T) + static inline int MutexInit(Mutex* mutex) { mutexInit(mutex); return 0; @@ -71,12 +73,12 @@ static inline int ThreadCreate(Thread* thread, ThreadEntry entry, void* context) return threadStart(thread); } -static inline int ThreadJoin(Thread thread) { - int res = threadWaitForExit(&thread); +static inline int ThreadJoinPtr(Thread* thread) { + int res = threadWaitForExit(thread); if(R_FAILED(res)) { return res; } - return threadClose(&thread); + return threadClose(thread); } static inline void ThreadSetName(const char* name) {