comparison Implab/SyncContextPromise.cs @ 72:d67b95eddaf4 v2

promises refactoring
author cin
date Thu, 04 Sep 2014 18:47:12 +0400
parents
children 279e226dffdd
comparison
equal deleted inserted replaced
71:1714fd8678ef 72:d67b95eddaf4
1 using System.Threading;
2
3 namespace Implab {
4 public class SyncContextPromise<T> : Promise<T> {
5 readonly SynchronizationContext m_context;
6
7 public SyncContextPromise(SynchronizationContext context) {
8 Safe.ArgumentNotNull(context, "context");
9 m_context = context;
10 }
11
12 public SyncContextPromise(SynchronizationContext context, IPromise parent, bool cancellable)
13 : base(parent, cancellable) {
14 Safe.ArgumentNotNull(context, "context");
15 m_context = context;
16 }
17 protected override void InvokeHandler(HandlerDescriptor handler) {
18 m_context.Post(x => base.InvokeHandler(handler),null);
19 }
20 }
21 }
22