Easy Thread Question

  • Thread starter Thread starter Dino M. Buljubasic
  • Start date Start date
D

Dino M. Buljubasic

I dont know much about threads, so please be easy on explaining me this one.

How do I stop a thread completelly (kill it)?

What happens with a thread that has been started but not killed?

The reason I am asking this is that one of my applications does not removed
from the Task Manager even though I close all my forms and call explicitly
Applicaton.exit at the end. I was thingking the thread inside it might be
the reason. If not, what else could be the reason it just stays hanging in
the Task Manager?

Thank you,
 
hi, i used to have this kinda problem but after i use

(assumming you are writing windows form application)
Private Sub form1_Closed(ByVal sender As Object, ByVal e
As System.EventArgs) Handles MyBase.Closed
End
End Sub

everything terminate properly....
 
Dino,
I thought that threads are not killed directly is by design (if it is not a
real crazy thing), the framework kills it after a while.
The "thread".abort exist. But that does not remove it direct from memory.
Why the program not is clossing, is for me impossible to see from here.
Cor
 
That is what I thought too but it is the only possible problem I can see.

It is closing, all my forms get closed, but the blue square in IDE tool menu
is still shown and the application is still in Task Manager.

Thanks for your help
 
Hello,

Dino M. Buljubasic said:
How do I stop a thread completelly (kill it)?

What happens with a thread that has been started but not
killed?
[...]

You may want to set a boolean flag that is checked by the tread before
exitting. This flag will tell the thread to exit. 'Thread.Abort' usually
should not be used, the thread should kill itself.
 
Back
Top