SyncContextPromise.cs
22 lines
| 689 B
| text/x-csharp
|
CSharpLexer
/ Implab / SyncContextPromise.cs
cin
|
r72 | using System.Threading; | ||
namespace Implab { | ||||
public class SyncContextPromise<T> : Promise<T> { | ||||
readonly SynchronizationContext m_context; | ||||
public SyncContextPromise(SynchronizationContext context) { | ||||
Safe.ArgumentNotNull(context, "context"); | ||||
m_context = context; | ||||
} | ||||
cin
|
r101 | public SyncContextPromise(SynchronizationContext context, IPromise parent) | ||
: base(parent) { | ||||
cin
|
r72 | Safe.ArgumentNotNull(context, "context"); | ||
m_context = context; | ||||
} | ||||
protected override void InvokeHandler(HandlerDescriptor handler) { | ||||
m_context.Post(x => base.InvokeHandler(handler),null); | ||||
} | ||||
} | ||||
} | ||||