annotate Implab/SyncContextPromise.cs @ 104:5f10d54b45df v2

renamed Promise.Last -> Promise.On Promise.On doesn't changes Promise.IsExclusive property
author cin
date Sun, 09 Nov 2014 23:03:45 +0300
parents 279e226dffdd
children d4e38929ce36
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 }
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
17 protected override void InvokeHandler(HandlerDescriptor handler) {
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