Skip to content

IMainThreadDispatcher.RunOnMainThread(Action, bool) Method

Definition

Namespace: Brine2D.Threading

Queues work to run on the main thread, or executes it immediately if already on the main thread, before the game loop starts, or after it has shut down.

void RunOnMainThread(System.Action work, bool waitForCompletion=false);

Parameters

work System.Action

The work to execute on the main thread.

waitForCompletion System.Boolean

If true, blocks the calling thread until the work completes. Prefer RunOnMainThreadAsync(Action, CancellationToken) for cancellable async callers.