コード例 #1
0
        public void Run()
        {
            var previousContext = SynchronizationContext.Current;

            try
            {
                singleContext = new SingleContext();
                SynchronizationContext.SetSynchronizationContext(singleContext);
                var execution = Start();
                execution.ContinueWith(delegate { singleContext.Complete(); }, TaskScheduler.Default);
                singleContext.Run();
                execution.Wait();
            }
            finally
            {
                SynchronizationContext.SetSynchronizationContext(previousContext);
            }
        }
コード例 #2
0
 public void Stop()
 {
     running = false;
     singleContext.Complete();
 }