table of contents
- trixie 3.2.10+ds-1
- testing 3.4.0+ds-1
- unstable 3.4.2+ds-1
- experimental 3.4.0+git20260203~8107d5b+ds-1
| SDL_WaitThread(3) | SDL3 FUNCTIONS | SDL_WaitThread(3) |
NAME¶
SDL_WaitThread - Wait for a thread to finish.
SYNOPSIS¶
#include <SDL3/SDL_thread.h>
void SDL_WaitThread(SDL_Thread *thread, int *status);
DESCRIPTION¶
Threads that haven't been detached will remain until this function cleans them up. Not doing so is a resource leak.
Once a thread has been cleaned up through this function, the SDL_Thread that references it becomes invalid and should not be referenced again. As such, only one thread may call SDL_WaitThread() on another.
The return code from the thread function is placed in the area pointed to by status, if status is not NULL.
You may not wait on a thread that has been used in a call to SDL_DetachThread(). Use either that function or this one, but not both, or behavior is undefined.
It is safe to pass a NULL thread to this function; it is a no-op.
Note that the thread pointer is freed by this function and is not valid afterward.
FUNCTION PARAMETERS¶
THREAD SAFETY¶
It is safe to call this function from any thread, but only a single thread can wait any specific thread to finish.
AVAILABILITY¶
This function is available since SDL 3.2.0.
SEE ALSO¶
| SDL 3.4.2 | Simple Directmedia Layer |