public bool StopRequested() { if (_semaphore.StopRequested) { _semaphore.ReportStop(); } return(false); }
/// <summary> /// Waits for resume or halt. /// </summary> void DoPause() { if (Paused != null) { Paused(); } int handle = WaitHandle.WaitAny(new WaitHandle[] {_resumeEvent, _semaphore.StopEvent}); System.Diagnostics.Debug.WriteLine("Resume or stop"); if (handle == 1) { System.Diagnostics.Debug.WriteLine("STOP - exit test"); _semaphore.ReportStop(); return; } else { _resumeEvent.Reset(); System.Diagnostics.Debug.WriteLine("Continue test"); _pause = false; } }