Thread state after it's initiator exits.

G

Guest

My main program starts a thread. My question is what happens to the thread
when the main program goes away? Does the thread exits automaticly with the
main, or does the main program need to make sure that it stops the thread
before it terminating itself?

Thanks.

Feng
 
A

Armin Zingler

Feng said:
My main program starts a thread. My question is what happens to the
thread when the main program goes away? Does the thread exits
automaticly with the main, or does the main program need to make
sure that it stops the thread before it terminating itself?


Why not try it? :)

Unless the new thread is not a background thread (t.IsBackground = True),
the process does not exit before all threads exited.

Details:
http://msdn.microsoft.com/library/en-us/dllproc/base/terminating_a_process.asp


Armin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top