72
|
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
|