G
Guest
I have an MDI parent with one or more children forms. Each child form has an engine thread that processes data. The child form's _Closing event is roughly
01 Private Sub frmConvertable_Closing(sender, e
02 'Show the form (other MDI children may be on top
03 Me.Activate(
04 mvarEngineThread.Suspen
05 e.Cancel = MessageBox.Show(strQuitMessage, strQuitTitle,
MessageboxButtons.OKCancel) = DialogResult.Cance
06 mvarEngineThread.Resum
07 'Thread is terminated in _Closed even
08 End Su
I set the cancelButton property of the MDI child to close the child using ESC
When I run the application and hold down Esc to continually call the closing event and cancel the messagebox (resume processing), after a few seconds the application hangs. Breaking into the debugger shows that line 05 is highlighted green
If I comment out the mvarEngineThread suspend and resume (lines 04 and 06) the application never hangs when I hold down Esc
Can anybody offer an explaination for this
Instead of posting my actual thread processing code, I can replicate the problem using the following
Public Sub ThreadProc(
D
For i As Integer = 0 To 100
Dim a As New System.Text.StringBuilder(400
Nex
System.Threading.Thread.Sleep(0
Loo
End Su
01 Private Sub frmConvertable_Closing(sender, e
02 'Show the form (other MDI children may be on top
03 Me.Activate(
04 mvarEngineThread.Suspen
05 e.Cancel = MessageBox.Show(strQuitMessage, strQuitTitle,
MessageboxButtons.OKCancel) = DialogResult.Cance
06 mvarEngineThread.Resum
07 'Thread is terminated in _Closed even
08 End Su
I set the cancelButton property of the MDI child to close the child using ESC
When I run the application and hold down Esc to continually call the closing event and cancel the messagebox (resume processing), after a few seconds the application hangs. Breaking into the debugger shows that line 05 is highlighted green
If I comment out the mvarEngineThread suspend and resume (lines 04 and 06) the application never hangs when I hold down Esc
Can anybody offer an explaination for this
Instead of posting my actual thread processing code, I can replicate the problem using the following
Public Sub ThreadProc(
D
For i As Integer = 0 To 100
Dim a As New System.Text.StringBuilder(400
Nex
System.Threading.Thread.Sleep(0
Loo
End Su