comparison Implab/SyncContextPromise.cs @ 211:3eb3255d8cc5 v2

Code review, added a non generic version of SyncContextPromise
author cin
date Tue, 21 Mar 2017 17:29:13 +0300
parents 97fbbf816844
children
comparison
equal deleted inserted replaced
210:5dc21f6a3222 211:3eb3255d8cc5
1 using System.Threading; 1 using System;
2 using System; 2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using System.Threading;
3 6
4 namespace Implab { 7 namespace Implab {
5 public class SyncContextPromise<T> : Promise<T> { 8 public class SyncContextPromise : Promise {
6 readonly SynchronizationContext m_context; 9 readonly SynchronizationContext m_context;
7 10
8 public SyncContextPromise(SynchronizationContext context) { 11 public SyncContextPromise(SynchronizationContext context) {
9 Safe.ArgumentNotNull(context, "context"); 12 Safe.ArgumentNotNull(context, "context");
13
10 m_context = context; 14 m_context = context;
11 } 15 }
12 16
13 protected override void SignalHandler(HandlerDescriptor handler, int signal) { 17 protected override void SignalHandler(HandlerDescriptor handler, int signal) {
14 m_context.Post(x => base.SignalHandler(handler, signal), null); 18 m_context.Post(x => base.SignalHandler(handler, signal), null);
15 } 19 }
16 } 20 }
17 } 21 }
18