Program exit troubleshooted and corrected, TODO: Shutdown of camera threads (2 stage StopDevice ?).
This commit is contained in:
parent
be7c433343
commit
4fd332490a
@ -655,10 +655,10 @@ namespace TBF.BenchControl
|
||||
///
|
||||
/// Executed when the state machine is stopped
|
||||
///
|
||||
foreach (var device in devices) device.RunDeviceBefore();
|
||||
wlog.Fatal("quitStateMachine == true ... The last StopOperaions() start now");
|
||||
State.StopOperations();
|
||||
foreach (var device in devices) device.StopDevice();
|
||||
stateMachineRunning = false;
|
||||
wlog.Fatal("StopOperaions() completed ... stateMachineRunning = false)");
|
||||
|
||||
throw new QuitStateMachineException();
|
||||
}
|
||||
@ -683,18 +683,13 @@ namespace TBF.BenchControl
|
||||
|
||||
TimeSpan timeFromStart = TimeSpan.FromSeconds(currentTimeSec);
|
||||
DateTime nextLoopDateTime = startDateTime + timeFromStart;
|
||||
|
||||
while (DateTime.Now < nextLoopDateTime)
|
||||
{
|
||||
Thread.Sleep(100);
|
||||
|
||||
if (quitStateMachine)
|
||||
{
|
||||
wlog.Info("quitStateMachine == true ... going to stop the StateMachine()");
|
||||
return true;
|
||||
}
|
||||
Thread.Sleep(100);
|
||||
if (quitStateMachine) return true;
|
||||
}
|
||||
|
||||
wlog.DebugFormat(" currentTime = {0}s", currentTimeSec);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -563,7 +563,9 @@ namespace TBF
|
||||
|
||||
/// Stop the system
|
||||
BenchControl.StateMachine.Stop();
|
||||
while (BenchControl.StateMachine.Running) { } /// wait until the last StopOperaions() completes
|
||||
BenchControl.StateMachine.StopDevices();
|
||||
|
||||
UiBridge.Bridge.OnEmergencyStopChanged(this, UiBridge.EmergencyStopEventArgs.State.CloseForm);
|
||||
|
||||
/// Close 'Closing_Test_Bench_Framework' modeless window
|
||||
|
||||
Loading…
Reference in New Issue
Block a user