- migliorie restart

This commit is contained in:
Emmanuele Sassi
2023-05-17 13:11:12 +02:00
parent 84c7d075b3
commit 4f862b2c8d
+11 -3
View File
@@ -237,7 +237,8 @@ Public Class ProcMan
' se qualche processo in stop, lo faccio ripartire
For ThreadIndex = 0 To ThreadList.Count - 1
Dim Thread = ThreadList(ThreadIndex)
If Thread.ThreadState = ThreadState.Stopped Then
If Thread.ThreadState = ThreadState.Stopped AndAlso Thread.ThreadState = ThreadState.Aborted AndAlso
Thread.ThreadState = ThreadState.Suspended Then
Thread.Abort()
Dim ThreadId As Integer = ThreadIndex
Thread = New Thread(Sub()
@@ -763,6 +764,7 @@ Public Class ProcMan
' controllo se cambiato il num thread
If numReq <> m_MaxCamInstances Then
stopAllThreads()
Thread.Sleep(100)
SetMaxCamInstances(numReq)
'startAllThreads()
End If
@@ -916,9 +918,15 @@ Public Class ProcMan
Private Sub CheckStartAutoRestart()
TimerCheck.Enabled = chkAutoRestart.Checked
If chkAutoRestart.Checked Then
If m_ExecutionThread.ThreadState = ThreadState.Aborted OrElse m_ExecutionThread.ThreadState = ThreadState.Stopped OrElse
m_ExecutionThread.ThreadState = ThreadState.Suspended Then
stopAllThreads()
Thread.Sleep(200)
m_ExecutionThread.Abort()
Thread.Sleep(200)
startAllThreads()
End If
TimerCheck.Start()
Task.Delay(500)
startAllThreads()
Else
TimerCheck.Stop()
End If