kernel: Wrap SDL_CreateThread in SDL_DetachThread

SDL3 tracks threads and reports them as leaked if you don't call
`SDL_WaitThread()` or `SDL_DetachThread()` on them. With
`SDL_DetachThread()` we can tell SDL to clean up automatically after a
thread exits.

This prevents "Leaked thread" log spam on quit.
This commit is contained in:
Aku Kotkavuo
2026-01-11 13:52:05 +02:00
committed by Zangetsu
parent df0e366d24
commit d162a3c9fc
+1 -1
View File
@@ -148,7 +148,7 @@ ThreadStatePtr KernelState::create_thread(MemState &mem, const char *name, Ptr<c
params.thid = thread->id;
params.host_may_destroy_params = SDL_CreateSemaphore(0);
SDL_CreateThread(&thread_function, thread->name.c_str(), &params);
SDL_DetachThread(SDL_CreateThread(&thread_function, thread->name.c_str(), &params));
SDL_WaitSemaphore(params.host_may_destroy_params);
SDL_DestroySemaphore(params.host_may_destroy_params);
return thread;