Man page - sdl_runonmainthread(3)
Packages contains this manual
Manual
SDL_RunOnMainThread
NAMEHEADER FILE
SYNOPSIS
DESCRIPTION
FUNCTION PARAMETERS
RETURN VALUE
THREAD SAFETY
AVAILABILITY
SEE ALSO
NAME
SDL_RunOnMainThread - Call a function on the main thread during event processing.
HEADER FILE
Defined in SDL3/SDL_init.h
SYNOPSIS
#include "SDL3/SDL.h"
bool SDL_RunOnMainThread(SDL_MainThreadCallback callback, void *userdata, bool wait_complete);
DESCRIPTION
If this is called on the main thread, the callback is executed immediately. If this is called on another thread, this callback is queued for execution on the main thread during event processing.
Be careful of deadlocks when using this functionality. You should not have the main thread wait for the current thread while this function is being called with wait_complete true.
FUNCTION PARAMETERS
callback
the callback to call on the main thread.
userdata
a pointer that is passed to callback .
wait_complete
true to wait for the callback to complete, false to return immediately.
RETURN VALUE
Returns true on success or false on failure; call
SDL_GetError () for more information.
THREAD SAFETY
It is safe to call this function from any thread.
AVAILABILITY
This function is available since SDL 3.2.0.
SEE ALSO
• (3), SDL_IsMainThread (3)