C
Chris Botha
I am creating a worker thread from inside an aspx page and the thread does
the stuff it should do, no problem.
However, I have noticed running it in the debugger that it seems as if the
threads are not killed/garbage-collected after a thread terminates. I have a
breakpoint in the thread itself and every time it breaks, in the Threads
window I observe the new thread, but the previous thread is still there as
well. The exact same code in a windows app performs as expected, on every
break there are two threads, the main thread and the current worker thread.
The simplified code below also gives the same results, so nothing strange in
the thread itself. If I put the code in a loop of 2000 cycles and break
after the last, then there are 2000 worker threads displayed in the Threads
window.
Dim ttt As Thread = New Thread(AddressOf TheThreadProc)
ttt.ApartmentState = Threading.ApartmentState.STA
ttt.Start()
ttt.Join()
And the simple thread:
Private Sub TheThreadProc()
Dim iii As Integer = 10
End Sub
the stuff it should do, no problem.
However, I have noticed running it in the debugger that it seems as if the
threads are not killed/garbage-collected after a thread terminates. I have a
breakpoint in the thread itself and every time it breaks, in the Threads
window I observe the new thread, but the previous thread is still there as
well. The exact same code in a windows app performs as expected, on every
break there are two threads, the main thread and the current worker thread.
The simplified code below also gives the same results, so nothing strange in
the thread itself. If I put the code in a loop of 2000 cycles and break
after the last, then there are 2000 worker threads displayed in the Threads
window.
Dim ttt As Thread = New Thread(AddressOf TheThreadProc)
ttt.ApartmentState = Threading.ApartmentState.STA
ttt.Start()
ttt.Join()
And the simple thread:
Private Sub TheThreadProc()
Dim iii As Integer = 10
End Sub