Mercurial > pub > ImplabNet
view Implab/SyncContextPromise.cs @ 88:c4877ae77cee v2
ServiceLocator: fixed services cleanup
author | cin |
---|---|
date | Tue, 07 Oct 2014 10:58:38 +0400 |
parents | d67b95eddaf4 |
children | 279e226dffdd |
line wrap: on
line source
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; } public SyncContextPromise(SynchronizationContext context, IPromise parent, bool cancellable) : base(parent, cancellable) { Safe.ArgumentNotNull(context, "context"); m_context = context; } protected override void InvokeHandler(HandlerDescriptor handler) { m_context.Post(x => base.InvokeHandler(handler),null); } } }