comparison Implab/IPromise.cs @ 12:eb418ba8275b promises

refactoring, added WorkerPool
author cin
date Tue, 05 Nov 2013 19:55:34 +0400
parents 6ec82bf68c8e
children e3935fdf59a2
comparison
equal deleted inserted replaced
11:6ec82bf68c8e 12:eb418ba8275b
3 using System.Linq; 3 using System.Linq;
4 using System.Text; 4 using System.Text;
5 5
6 namespace Implab 6 namespace Implab
7 { 7 {
8 public interface IPromise 8 public interface IPromise: ICancellable
9 { 9 {
10 /// <summary> 10 /// <summary>
11 /// Check whereather the promise has no more than one dependent promise. 11 /// Check whereather the promise has no more than one dependent promise.
12 /// </summary> 12 /// </summary>
13 bool IsExclusive 13 bool IsExclusive
22 { 22 {
23 get; 23 get;
24 } 24 }
25 25
26 /// <summary> 26 /// <summary>
27 /// Tries to cancel the the complete chain of promises.
28 /// </summary>
29 /// <returns><c>true</c> - if the promise has been cancelled, otherwise the promise will be resolved (or resolved already).</returns>
30 bool Cancel();
31
32 /// <summary>
33 /// Registers handler for the case when the promise is cencelled. If the promise already cancelled the 27 /// Registers handler for the case when the promise is cencelled. If the promise already cancelled the
34 /// handler will be invoked immediatelly. 28 /// handler will be invoked immediatelly.
35 /// </summary> 29 /// </summary>
36 /// <param name="handler">The handler</param> 30 /// <param name="handler">The handler</param>
37 void HandleCancelled(Action handler); 31 void HandleCancelled(Action handler);