Switch: Fix threading-related crash on second launch

This commit is contained in:
Vicki Pfau 2019-05-26 14:26:35 -07:00
parent c2b6692ce2
commit c5b686fce2
2 changed files with 9 additions and 3 deletions

View File

@ -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)

View File

@ -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) {