##// END OF EJS Templates
implemeted new cancellable promises concept
implemeted new cancellable promises concept

File last commit:

r10:aa33d0bb8c0c promises
r10:aa33d0bb8c0c promises
Show More
IPromise.cs
40 lines | 1.2 KiB | text/x-csharp | CSharpLexer
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Implab
{
public interface IPromise
{
/// <summary>
/// Check whereather the promise has no more than one dependent promise.
/// </summary>
bool IsExclusive
{
get;
}
/// <summary>
/// The current state of the promise.
/// </summary>
PromiseState State
{
get;
}
/// <summary>
/// Tries to cancel the promise or the complete chain.
/// </summary>
/// <param name="dependencies">Try to cancel the whole promise chain, the parent promise will be cancelled only if it has only one promise</param>
/// <returns></returns>
bool Cancel(bool dependencies);
/// <summary>
/// Registers handler for the case when the promise is cencelled. If the promise already cancelled the
/// handler will be invoked immediatelly.
/// </summary>
/// <param name="handler">The handler</param>
void HandleCancelled(Action handler);
}
}