Beispiel #1
0
        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.");
            }
        }
Beispiel #2
0
 public void StopWork()
 {
     PauseEvent.Set();
     Workers.ForEach(x => x.Item2.Cancel());
     RevertWorker?.Item2.Cancel();
 }
Beispiel #3
0
 public void ResumeWork()
 {
     PauseEvent.Set();
 }
 /// <summary>
 /// Unblock thread
 /// </summary>
 public static void Unpause()
 {
     SimulationShouldPause = false;
     PauseEvent.Set();
 }
Beispiel #5
0
        public void Pause()
        {
            ResumeEvent.Reset();

            PauseEvent.Set();
        }