Mercurial > pub > ImplabNet
annotate Implab/SyncContextPromise.cs @ 119:2573b562e328 v2
Promises rewritten, added improved version of AsyncQueue
author | cin |
---|---|
date | Sun, 11 Jan 2015 19:13:02 +0300 |
parents | d4e38929ce36 |
children | f75cfa58e3d4 |
rev | line source |
---|---|
72 | 1 using System.Threading; |
2 | |
3 namespace Implab { | |
4 public class SyncContextPromise<T> : Promise<T> { | |
5 readonly SynchronizationContext m_context; | |
6 | |
7 public SyncContextPromise(SynchronizationContext context) { | |
8 Safe.ArgumentNotNull(context, "context"); | |
9 m_context = context; | |
10 } | |
11 | |
119
2573b562e328
Promises rewritten, added improved version of AsyncQueue
cin
parents:
106
diff
changeset
|
12 protected override void SignalSuccess(IDeferred<T> handler) { |
2573b562e328
Promises rewritten, added improved version of AsyncQueue
cin
parents:
106
diff
changeset
|
13 m_context.Post(x => base.SignalSuccess(handler), null); |
72 | 14 } |
119
2573b562e328
Promises rewritten, added improved version of AsyncQueue
cin
parents:
106
diff
changeset
|
15 |
2573b562e328
Promises rewritten, added improved version of AsyncQueue
cin
parents:
106
diff
changeset
|
16 protected override void SignalError(IDeferred<T> handler, System.Exception error) { |
2573b562e328
Promises rewritten, added improved version of AsyncQueue
cin
parents:
106
diff
changeset
|
17 m_context.Post(x => base.SignalError(handler, error), null); |
2573b562e328
Promises rewritten, added improved version of AsyncQueue
cin
parents:
106
diff
changeset
|
18 } |
2573b562e328
Promises rewritten, added improved version of AsyncQueue
cin
parents:
106
diff
changeset
|
19 |
2573b562e328
Promises rewritten, added improved version of AsyncQueue
cin
parents:
106
diff
changeset
|
20 protected override void SignalCancelled(IDeferred<T> handler) { |
2573b562e328
Promises rewritten, added improved version of AsyncQueue
cin
parents:
106
diff
changeset
|
21 m_context.Post(x => base.SignalCancelled(handler), null); |
72 | 22 } |
23 } | |
24 } | |
25 |