SdlRunOnMainThread
Call a function on the main thread during event processing.
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 AWaitComplete
true.
Definition
Unit: Neslib.Sdl3.Basics
procedure SdlRunOnMainThread(const ACallback: TSdlMainThreadCallback;
const AWaitComplete: Boolean = False)
Parameters
ACallback
: TSdlMainThreadCallback
: The callback to call on the main thread.
AWaitComplete
: Boolean = False
: (Optional) True to wait for the callback to complete, False (default) to return immediately.
Exceptions
ESdlError
: Raised on failure.
See Also
Remarks
It is safe to call this function from any thread.