Mercurial > pub > ImplabNet
comparison Implab/SyncContextPromise.cs @ 138:f75cfa58e3d4 v2
added ICancellable.Cancel(Exception) to allow specify the reason of cancellation
author | cin |
---|---|
date | Tue, 17 Feb 2015 18:16:26 +0300 |
parents | 2573b562e328 |
children | 706fccb85524 |
comparison
equal
deleted
inserted
replaced
137:238e15580926 | 138:f75cfa58e3d4 |
---|---|
1 using System.Threading; | 1 using System.Threading; |
2 using System; | |
2 | 3 |
3 namespace Implab { | 4 namespace Implab { |
4 public class SyncContextPromise<T> : Promise<T> { | 5 public class SyncContextPromise<T> : Promise<T> { |
5 readonly SynchronizationContext m_context; | 6 readonly SynchronizationContext m_context; |
6 | 7 |
11 | 12 |
12 protected override void SignalSuccess(IDeferred<T> handler) { | 13 protected override void SignalSuccess(IDeferred<T> handler) { |
13 m_context.Post(x => base.SignalSuccess(handler), null); | 14 m_context.Post(x => base.SignalSuccess(handler), null); |
14 } | 15 } |
15 | 16 |
16 protected override void SignalError(IDeferred<T> handler, System.Exception error) { | 17 protected override void SignalError(IDeferred<T> handler, Exception error) { |
17 m_context.Post(x => base.SignalError(handler, error), null); | 18 m_context.Post(x => base.SignalError(handler, error), null); |
18 } | 19 } |
19 | 20 |
20 protected override void SignalCancelled(IDeferred<T> handler) { | 21 protected override void SignalCancelled(IDeferred<T> handler, Exception reason) { |
21 m_context.Post(x => base.SignalCancelled(handler), null); | 22 m_context.Post(x => base.SignalCancelled(handler, reason), null); |
22 } | 23 } |
23 } | 24 } |
24 } | 25 } |
25 | 26 |