Larry Brister
asked on
Windows Service clean up threads on stop
WHat would be the way to properly clean up these threads in the Windows Service OnStop?
Dim phoneWorkerThread As New Threading.Thread(AddressOf startPhoneMonitoring)
phoneWorkerThread.Name = "Thread " + " | [" + dataRowString + "] " + System.Guid.NewGuid.ToString()
phoneWorkerThread.IsBackground = True
phoneWorkerThread.Start(sendRow)
If I remember correctly, you maintain a list of these threads right? You would need to abort all these threads before the service dies.
ASKER
CodeCruiser,
So along these lines (using the dictionaty list)
Dim t As Thread
For Each t In Diagnostics.Process.GetCur rentProces s().Thread s
t.Abort()
Next t
So along these lines (using the dictionaty list)
Dim t As Thread
For Each t In Diagnostics.Process.GetCur
t.Abort()
Next t
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Bingo! Thanks