logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

SDL_RunOnMainThread - Call a function on the main thread during event processing.

Availability

       This function is available since SDL 3.2.0.

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.

Name

       SDL_RunOnMainThread - Call a function on the main thread during event processing.

Return Value

       for more information.

See Also

SDL_IsMainThread(3)

Simple Directmedia Layer                           SDL 3.2.20                             SDL_RunOnMainThread(3)

Synopsis

#include<SDL3/SDL_init.h>boolSDL_RunOnMainThread(SDL_MainThreadCallbackcallback,void*userdata,boolwait_complete);

Thread Safety

       It is safe to call this function from any thread.

See Also