view 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 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 SignalHandler(HandlerDescriptor handler, int signal) {
            m_context.Post(x => base.SignalHandler(handler, signal), null);
        }
    }
}