mirror of
https://github.com/Vita3K/Vita3K.git
synced 2026-07-11 01:34:23 +02:00
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:
@@ -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(), ¶ms);
|
||||
SDL_DetachThread(SDL_CreateThread(&thread_function, thread->name.c_str(), ¶ms));
|
||||
SDL_WaitSemaphore(params.host_may_destroy_params);
|
||||
SDL_DestroySemaphore(params.host_may_destroy_params);
|
||||
return thread;
|
||||
|
||||
Reference in New Issue
Block a user