using System; using System.Threading; using System.Threading.Tasks; namespace ComposableAsync { /// /// Dispatcher executes an action or a function /// on its own context /// public interface IDispatcher { /// /// Execute action on dispatcher context in a /// none-blocking way /// /// void Dispatch(Action action); /// /// Enqueue the action and return a task corresponding to /// the completion of the action /// /// /// Task Enqueue(Action action); /// /// Enqueue the function and return a task corresponding to /// the result of the function /// /// /// /// Task Enqueue(Func action); /// /// Enqueue the task and return a task corresponding to /// the completion of the task /// /// /// Task Enqueue(Func action); /// /// Enqueue the task and return a task corresponding /// to the execution of the original task /// /// /// /// Task Enqueue(Func> action); /// /// Enqueue the function and return a task corresponding /// to the execution of the task /// /// /// /// /// /// Task Enqueue(Func action, CancellationToken cancellationToken); /// /// Enqueue the action and return a task corresponding /// to the execution of the task /// /// /// /// Task Enqueue(Action action, CancellationToken cancellationToken); /// /// Enqueue the task and return a task corresponding /// to the execution of the task /// /// /// /// Task Enqueue(Func action, CancellationToken cancellationToken); /// /// Enqueue the task and return a task corresponding /// to the execution of the original task /// /// /// /// /// Task Enqueue(Func> action, CancellationToken cancellationToken); /// /// Clone dispatcher /// /// IDispatcher Clone(); } }