Mercurial > pub > ImplabNet
diff Implab/SyncContextPromiseT.cs @ 211:3eb3255d8cc5 v2
Code review, added a non generic version of SyncContextPromise
author | cin |
---|---|
date | Tue, 21 Mar 2017 17:29:13 +0300 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Implab/SyncContextPromiseT.cs Tue Mar 21 17:29:13 2017 +0300 @@ -0,0 +1,18 @@ +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 SignalHandler(HandlerDescriptor handler, int signal) { + m_context.Post(x => base.SignalHandler(handler, signal), null); + } + } +} +