annotate Implab/SyncContextPromise.cs @ 134:04d4c92d0f28 v2

Improved logging
author cin
date Wed, 11 Feb 2015 02:12:15 +0300
parents 2573b562e328
children f75cfa58e3d4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
72
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
1 using System.Threading;
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
2
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
3 namespace Implab {
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
4 public class SyncContextPromise<T> : Promise<T> {
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
5 readonly SynchronizationContext m_context;
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
6
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
7 public SyncContextPromise(SynchronizationContext context) {
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
8 Safe.ArgumentNotNull(context, "context");
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
9 m_context = context;
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
10 }
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
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
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
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
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
22 }
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
23 }
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
24 }
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
25