view Implab/SyncContextPromise.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 97fbbf816844
children
line wrap: on
line source

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;

namespace Implab {
    public class SyncContextPromise : Promise {
        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);
        }
    }
}