Beispiel #1
0
 /// <returns>True to quit loop</returns>
 private bool PauseLoop(BreakPoint breakPoint, string reason)
 {
     running = false;
     signalRunning.Reset();
     signalPaused.Set();
     {
         try
         {
             //inversed lock
             Monitor.Exit(this);
             if (engineStoppedCallback != null)
             {
                 engineStoppedCallback.Invoke(false, breakPoint, reason);
             }
             signalRun.WaitOne();
         }
         finally
         {
             Monitor.Enter(this);
             //inversed lock end
         }
     }
     if (quit || stepResult == StepResult.Finished)
     {
         return(true);
     }
     pause   = false;
     running = true;
     signalPaused.Reset();
     signalRunning.Set();
     return(false);
 }
Beispiel #2
0
        /// <returns>True to quit loop</returns>
        private bool LoopBody()
        {
            lock (this)
            {
                SlowdownLoop(); // warning! intentional inversed lock inside
                if (quit)
                {
                    return(true);
                }
                if (pause)
                {
                    if (PauseLoop(null, null)) // warning! intentional inversed lock inside
                    {
                        return(true);
                    }
                }

                //step
                stepResult = engine.NextStep();

                if (stepResult != StepResult.Finished)
                {
                    string     reason;
                    BreakPoint breakPoint = Project.BreakPoints.ShouldBreak(engine, out reason);
                    if (breakPoint != null)
                    {
                        signalRun.Reset();
                        pause = true;
                        if (PauseLoop(breakPoint, reason)) // warning! intentional inversed lock inside
                        {
                            return(true);
                        }
                    }
                }
            }
            return(false);
        }