protected override IEnumerator Do() { while (!ExitEvent.InterWaitOne(0)) { if (Dispatcher.ProcessNextTask()) { continue; } TaskDistributor.FillTasks(Dispatcher); if (Dispatcher.TaskCount != 0) { continue; } var result = WaitHandle.WaitAny(new[] { ExitEvent, TaskDistributor.NewDataWaitHandle }); if (result == 0) { return(null); } TaskDistributor.FillTasks(Dispatcher); } return(null); }
/// <summary> /// Does this instance. /// </summary> /// <returns></returns> protected override IEnumerator Do() { while (!ExitEvent.InterWaitOne(0)) { _action(); var result = WaitHandle.WaitAny(new WaitHandle[] { ExitEvent, _tickEvent }, _tickLengthInMilliseconds); if (result == 0) { return(null); } } return(null); }