private void DoWorkOnThread(IWorkProvider workProvider) { try { Action work = workProvider.GetWork(); work(); } catch (Exception ex) { Interlocked.CompareExchange(ref _Exception, ex, null); Stop(); } }
public void DoWork() { // Update Summary while (!_workProvider.ShouldStop) { long?work = _workProvider.GetWork(); if (work.HasValue) { _results += work.Value; Debug.WriteLine("DeQueue: " + work.Value); } else { Thread.Sleep(10); } } }