public virtual void Pause() { try { PauseEvent.Set(); //Timer.Change(Timeout.Infinite, Timeout.Infinite); // Wait for any current execution to finish var timeout = Profile.StopTaskTimeout; if (RunEvent.WaitOne(0)) { ServiceProfile.Service.RequestAdditionalTime((int)timeout.TotalMilliseconds); if (RunEvent.WaitOne(timeout)) { LogWarning("still running during Pause process. Wait timer exceeded."); } } State = TaskState.Paused; } catch (Exception e) { LogException(e, "failed Pause process."); } }
public void StopWork() { PauseEvent.Set(); Workers.ForEach(x => x.Item2.Cancel()); RevertWorker?.Item2.Cancel(); }
public void ResumeWork() { PauseEvent.Set(); }
/// <summary> /// Unblock thread /// </summary> public static void Unpause() { SimulationShouldPause = false; PauseEvent.Set(); }
public void Pause() { ResumeEvent.Reset(); PauseEvent.Set(); }