Killing Threads

slopy

Member
Joined
Mar 15, 2006
Messages
7
Programming Experience
5-10
I really like the threading model in vb .net, I recently moved from vb 6.0 into the .Net world and it was actually a lot easier then I thought. \

Anyway, I like threading so much I use it a lot in my project. So much so that if the user closes the form while its working I have to cancel atleast 2 threads which takes an enourmous amount of time surprisingly. Is there anything faster then using Thread.Abort? Because that also generates an exception my catch statement tries to workout.

In its current state, canceling the form mid way takes about 3 secs for it to actually close. Which is rediculous.
 
You shouldn't use multi-threading unnecessarily just because you like it. Assuming that you aren't doing that then you may be able to set a variable that your threads look for at intervals and they will exit themselves if it is set to a certain value. You can also make your threads background threads so they will not prevent the app closing, although you then lose the opportunity to cleanup.
 
No the threads are important, they download certain files and run file checks and such. Theres no sleeping done, all I want is the thread to continue working until done. But when the user clicks quit it takes so long to cancel the threads. I like the variable thing though, I'll give that a try.
 
Back
Top