public virtual void Dispose(bool force) { Stop(force); UnsetInterruptQueue(); //unset the interrupt queue RemoveAllInputs(); Name = null; Zone = null; StopTrigger?.Dispose(); StopTrigger = null; StopTestingTrigger?.Dispose(); StopTestingTrigger = null; StartTrigger?.Dispose(); StartTrigger = null; }
protected override void StopCore(bool force) { //subclass processing PreStop(force); DebugTools.AddEvent("LoopingZoneProgram.StopCore", "STOP " + Name); //DebugTools.AddEvent("LoopingZoneProgram.StopCore", "Canceling Sync-State on Program " + Name); //cancel sync state req and release from sync state CancelSyncState(); //DebugTools.AddEvent("LoopingZoneProgram.Stop", "START Stopping BG Program"); if (Running) { //DebugTools.AddEvent("LoopingZoneProgram.Stop", "Running = TRUE"); if (force) { if (RunProgramThread != null) { //DebugTools.AddEvent("LoopingZoneProgram.Stop", "START Force aborting BG Program thread"); RunProgramThread.Abort(); StopTrigger.WaitForFire(); //DebugTools.AddEvent("LoopingZoneProgram.Stop", "END Force aborting BG Program thread"); } else { //DebugTools.AddEvent("LoopingZoneProgram.Stop", "RunProgramThread was null"); //DebugTools.Print(); } } else { LoopCTS.Cancel(); if (!StopTrigger.WaitForFire()) { //DebugTools.AddEvent("LoopingZoneProgram.Stop", "Loop did not cancel cooperatively."); //DebugTools.Print(); } } } PostStop(force); //DebugTools.AddEvent("LoopingZoneProgram.Stop", "END Stopping BG Program"); StopTestingTrigger.Fire(this, null); }