Mercurial > pub > ImplabNet
view Implab/Parallels/SyncContextDispatcher.cs @ 249:d82909310094 v3
Implab.Test moved to xunit
Complete set of PromiseHelpers (Then, Catch, Finally)
Removed obsolete types ICancellable, ICancellationToken
author | cin |
---|---|
date | Wed, 31 Jan 2018 11:28:38 +0300 |
parents | 5cb4826c2c2a |
children |
line wrap: on
line source
using System; using System.Threading; namespace Implab { public class SyncContextDispatcher : IDispatcher { SynchronizationContext m_context; public SyncContextDispatcher(SynchronizationContext context) { Safe.ArgumentNotNull(context, nameof(context)); m_context = context; } public void Enqueue(Action job) { m_context.Post((o) => job(), null); } public void Enqueue<T>(Action<T> job, T arg) { m_context.Post((o) => job((T)o), arg); } } }