Link to home
Start Free TrialLog in
Avatar of Larry Brister
Larry BristerFlag for United States of America

asked on

Kill thread from inside VB.Net Application

I have a windows service running

Inside a While statement I kick off a thread "for each" in the while

I am giving each thread a particular name

Once the while exits, all the threads are running.

How could I kill a particular thread by name from a different sub in the same service?

If Not sendRow Is Nothing And sendRow.Length > 20 Then
	'Declare and start individual thread for each (phonelist) loop
	Dim phoneWorkerThread As New Thread(AddressOf startPhoneMonitoring)
	phoneWorkerThread.Name = "Thread " + CStr(threadCounter)
	phoneWorkerThread.IsBackground = True
	phoneWorkerThread.Start(sendRow)
End If

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Larry Brister

ASKER

Agreed
After a lot of research that was my plan.
Just looking for some verification since I'm dealing with another in house developer who's first answer is ALWAYS...I think we should do it (not your way but mine) on anything that comes up.