Skip to content

MainThreadDispatcher API

supermax edited this page Jun 28, 2020 · 1 revision

Main Thread dispatcher is responsible for the synchronisation of callbacks between Main and other threads.

MainThreadDispatcher implements this interface
:

public interface IThreadDispatcher
{
    // managed Thread ID
    int ThreadId { get; }

    // dispatch - adds callback delegate into dispatcher’s queue
    // action - delegate reference to method that should be invoked on main thread
    // payload - the data that should be passed to the method/callback
    void Dispatch(Delegate action, object[] payload);
}

Dispatch Method - example


MainThreadDispatcher.Default.Dispatch(Callback, new object[] { payload, state });