Mercurial > pub > ImplabNet
view Implab/SyncContextPromise.cs @ 141:0fa293bb1351 v2
fixed JSON writer
author | cin |
---|---|
date | Tue, 24 Feb 2015 00:54:22 +0300 |
parents | f75cfa58e3d4 |
children | 706fccb85524 |
line wrap: on
line source
using System.Threading; using System; namespace Implab { public class SyncContextPromise<T> : Promise<T> { readonly SynchronizationContext m_context; public SyncContextPromise(SynchronizationContext context) { Safe.ArgumentNotNull(context, "context"); m_context = context; } protected override void SignalSuccess(IDeferred<T> handler) { m_context.Post(x => base.SignalSuccess(handler), null); } protected override void SignalError(IDeferred<T> handler, Exception error) { m_context.Post(x => base.SignalError(handler, error), null); } protected override void SignalCancelled(IDeferred<T> handler, Exception reason) { m_context.Post(x => base.SignalCancelled(handler, reason), null); } } }