Cleaned up thread state handling and added thread object validation

This commit is contained in:
Sam Lantinga
2024-12-26 09:28:01 -08:00
parent 7647f16ae1
commit eb1be89e70
6 changed files with 54 additions and 34 deletions

View File

@@ -126,7 +126,7 @@ void SDL_SYS_WaitThread(SDL_Thread *thread)
Detached threads can be waited on, but should NOT be cleaned manually
as it would result in a fatal error.
*/
if (R_SUCCEEDED(res) && SDL_GetAtomicInt(&thread->state) != SDL_THREAD_STATE_DETACHED) {
if (R_SUCCEEDED(res) && SDL_GetThreadState(thread) != SDL_THREAD_DETACHED) {
threadFree(thread->handle);
}
}