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
|
101
|
12 public SyncContextPromise(SynchronizationContext context, IPromise parent)
|
|
13 : base(parent) {
|
72
|
14 Safe.ArgumentNotNull(context, "context");
|
|
15 m_context = context;
|
|
16 }
|
106
|
17 protected override void InvokeHandler(AbstractHandler handler) {
|
72
|
18 m_context.Post(x => base.InvokeHandler(handler),null);
|
|
19 }
|
|
20 }
|
|
21 }
|
|
22
|