Skip to content
This repository has been archived by the owner on Feb 19, 2023. It is now read-only.

Commit

Permalink
fix: pause thread when testing
Browse files Browse the repository at this point in the history
  • Loading branch information
CCXXXI committed Jul 13, 2022
1 parent ae228d7 commit 69573d6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions frmMain.vb
Original file line number Diff line number Diff line change
Expand Up @@ -2101,6 +2101,7 @@ LocalErrorHandler:
FixBox.BackColor = IIf(_client.Report(), Color.Red, Color.Yellow)
End If
InitSerialInput()
_pause.Set()
Exit Sub

LocalErrorHandler:
Expand Down Expand Up @@ -2315,9 +2316,9 @@ LocalErrorHandler:
cmdLoadTestplan.Focus()
End If

Dim thread As New Thread(AddressOf BackgroundThread)
thread.Start()
_thread.Start()
End Sub
ReadOnly _thread As New Thread(AddressOf BackgroundThread)

Private Sub InitSerialInput()
' Set focus to the input box and clear it
Expand All @@ -2326,6 +2327,7 @@ LocalErrorHandler:
End Sub

ReadOnly _client As New TcpClient()
Dim _pause As New Threading.AutoResetEvent(False)
Private Sub BackgroundThread()
If Not _client.Connect() Then
Return
Expand All @@ -2338,6 +2340,7 @@ LocalErrorHandler:
Invoke(Sub()
cmdRun_Click(cmdRun, New System.EventArgs)
End Sub)
_pause.WaitOne()
End If
Thread.Sleep(500)
End While
Expand Down

0 comments on commit 69573d6

Please sign in to comment.