annotate Implab/SyncContextPromise.cs @ 245:b904e0a3ba72 v3

working on promises
author cin
date Fri, 26 Jan 2018 04:13:34 +0300
parents 3eb3255d8cc5
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
211
3eb3255d8cc5 Code review, added a non generic version of SyncContextPromise
cin
parents: 156
diff changeset
1 using System;
3eb3255d8cc5 Code review, added a non generic version of SyncContextPromise
cin
parents: 156
diff changeset
2 using System.Collections.Generic;
3eb3255d8cc5 Code review, added a non generic version of SyncContextPromise
cin
parents: 156
diff changeset
3 using System.Linq;
3eb3255d8cc5 Code review, added a non generic version of SyncContextPromise
cin
parents: 156
diff changeset
4 using System.Text;
3eb3255d8cc5 Code review, added a non generic version of SyncContextPromise
cin
parents: 156
diff changeset
5 using System.Threading;
3eb3255d8cc5 Code review, added a non generic version of SyncContextPromise
cin
parents: 156
diff changeset
6
3eb3255d8cc5 Code review, added a non generic version of SyncContextPromise
cin
parents: 156
diff changeset
7 namespace Implab {
3eb3255d8cc5 Code review, added a non generic version of SyncContextPromise
cin
parents: 156
diff changeset
8 public class SyncContextPromise : Promise {
3eb3255d8cc5 Code review, added a non generic version of SyncContextPromise
cin
parents: 156
diff changeset
9 readonly SynchronizationContext m_context;
3eb3255d8cc5 Code review, added a non generic version of SyncContextPromise
cin
parents: 156
diff changeset
10
3eb3255d8cc5 Code review, added a non generic version of SyncContextPromise
cin
parents: 156
diff changeset
11 public SyncContextPromise(SynchronizationContext context) {
3eb3255d8cc5 Code review, added a non generic version of SyncContextPromise
cin
parents: 156
diff changeset
12 Safe.ArgumentNotNull(context, "context");
3eb3255d8cc5 Code review, added a non generic version of SyncContextPromise
cin
parents: 156
diff changeset
13
3eb3255d8cc5 Code review, added a non generic version of SyncContextPromise
cin
parents: 156
diff changeset
14 m_context = context;
3eb3255d8cc5 Code review, added a non generic version of SyncContextPromise
cin
parents: 156
diff changeset
15 }
3eb3255d8cc5 Code review, added a non generic version of SyncContextPromise
cin
parents: 156
diff changeset
16
3eb3255d8cc5 Code review, added a non generic version of SyncContextPromise
cin
parents: 156
diff changeset
17 protected override void SignalHandler(HandlerDescriptor handler, int signal) {
3eb3255d8cc5 Code review, added a non generic version of SyncContextPromise
cin
parents: 156
diff changeset
18 m_context.Post(x => base.SignalHandler(handler, signal), null);
3eb3255d8cc5 Code review, added a non generic version of SyncContextPromise
cin
parents: 156
diff changeset
19 }
3eb3255d8cc5 Code review, added a non generic version of SyncContextPromise
cin
parents: 156
diff changeset
20 }
3eb3255d8cc5 Code review, added a non generic version of SyncContextPromise
cin
parents: 156
diff changeset
21 }