Mercurial > pub > ImplabNet
comparison Implab/IDeferred.cs @ 240:fa6cbf4d8841 v3
refactoring, moving to dotnercore, simplifying promises
| author | cin |
|---|---|
| date | Tue, 23 Jan 2018 19:39:21 +0300 |
| parents | 706fccb85524 |
| children |
comparison
equal
deleted
inserted
replaced
| 239:eedf4d834e67 | 240:fa6cbf4d8841 |
|---|---|
| 2 | 2 |
| 3 namespace Implab { | 3 namespace Implab { |
| 4 /// <summary> | 4 /// <summary> |
| 5 /// Deferred result, usually used by asynchronous services as the service part of the promise. | 5 /// Deferred result, usually used by asynchronous services as the service part of the promise. |
| 6 /// </summary> | 6 /// </summary> |
| 7 public interface IDeferred : ICancellationToken { | 7 public interface IDeferred { |
| 8 | 8 |
| 9 void Resolve(); | 9 void Resolve(); |
| 10 | 10 |
| 11 /// <summary> | 11 /// <summary> |
| 12 /// Reject the promise with the specified error. | 12 /// Reject the promise with the specified error. |
| 17 /// <see cref="OperationCanceledException"/> is interpreted as call to <see cref="Cancel()"/> method, | 17 /// <see cref="OperationCanceledException"/> is interpreted as call to <see cref="Cancel()"/> method, |
| 18 /// and <see cref="PromiseTransientException"/> is always unwrapped and its | 18 /// and <see cref="PromiseTransientException"/> is always unwrapped and its |
| 19 /// <see cref="PromiseTransientException.InnerException"> is used as the reason to reject promise. | 19 /// <see cref="PromiseTransientException.InnerException"> is used as the reason to reject promise. |
| 20 /// </remarks> | 20 /// </remarks> |
| 21 void Reject(Exception error); | 21 void Reject(Exception error); |
| 22 | |
| 23 /// <summary> | |
| 24 /// Marks current instance as cencelled with the specified reason. | |
| 25 /// </summary> | |
| 26 /// <param name="reason">The reason for the operation cancellation, | |
| 27 /// if not specified the new <see cref="OperationCanceledException"> will be created</param> | |
| 28 void SetCancelled(Exception reason); | |
| 22 } | 29 } |
| 23 } | 30 } |
| 24 | 31 |
