annotate Implab/SyncContextPromise.cs @ 106:d4e38929ce36 v2

promises refactoring
author cin
date Mon, 10 Nov 2014 18:00:28 +0300
parents 279e226dffdd
children 2573b562e328
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
101
279e226dffdd code cleanup
cin
parents: 72
diff changeset
12 public SyncContextPromise(SynchronizationContext context, IPromise parent)
279e226dffdd code cleanup
cin
parents: 72
diff changeset
13 : base(parent) {
72
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
14 Safe.ArgumentNotNull(context, "context");
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
15 m_context = context;
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
16 }
106
d4e38929ce36 promises refactoring
cin
parents: 101
diff changeset
17 protected override void InvokeHandler(AbstractHandler handler) {
72
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
18 m_context.Post(x => base.InvokeHandler(handler),null);
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
19 }
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
20 }
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
21 }
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
22