Mercurial > pub > ImplabNet
view Implab/ICancellationToken.cs @ 207:558f34b2fb50 v2
added Safe.DispatchEvent() a legacy equivalent for '?.Invoke()'
added Safe.Dispose(IEnumerable)
added PromiseExtensions.CancellationPoint to add a cancellation point to the chain of promises
added IPromise<T> PromiseExtensions.Then<T>(this IPromise<T> that, Action<T> success) overloads
added PromiseExtensions.Error() overloads to handle a error or(and) a cancellation
author | cin |
---|---|
date | Wed, 09 Nov 2016 12:03:22 +0300 |
parents | 706fccb85524 |
children |
line wrap: on
line source
using System; namespace Implab { public interface ICancellationToken { /// <summary> /// Indicates wherther the cancellation was requested. /// </summary> bool IsCancellationRequested { get ; } /// <summary> /// The reason why the operation should be cancelled. /// </summary> Exception CancellationReason { get ; } /// <summary> /// Accepts if requested. /// </summary> /// <returns><c>true</c>, if if requested was accepted, <c>false</c> otherwise.</returns> bool CancelOperationIfRequested(); /// <summary> /// Sets the token to cancelled state. /// </summary> /// <param name="reason">The reason why the operation was cancelled.</param> void CancelOperation(Exception reason); /// <summary> /// Adds the listener for the cancellation request, is the cancellation was requested the <paramref name="handler"/> /// is executed immediatelly. /// </summary> /// <param name="handler">The handler which will be executed if the cancel occurs.</param> void CancellationRequested(Action<Exception> handler); } }