Question about threading...

Status
Not open for further replies.

Magus`

Ars Legatus Legionis
30,136
Subscriptor++
I'm working on my XPlanet frontend, and I use threads to download the cloud image and to run XPlanet, so you can still do things in the program while those are going...

So my problem is, if the program is closed, the threads keep going until they finish. Is this normal, or do I need to do something to kill them on the closing event of the app?


Specific code segments in C# would help if anyone knows, but an idea would at least point me in the right direction :D
 

Handor

Ars Tribunus Militum
2,513
Check this article out for examples of how to go about registering appliction termination, telling the worker threads to stop, and making sure they do. The whole series is probably valuable, so here're links to each part:

Threading in .Net Part 1 - in which is covered what a thread is and how to start one.

Threading in .Net Part 2 (linked above) - in which is covered the managing thread lifetime.

Threading in .Net Part 3 - in which are covered threading priorities.

Threading in .Net Part 4 - in which are covered synchronization topics.

And, as an added bonus: MSDN article on threading (Note: Contains another sample app which terminates threads immediately in some cases, only after certain things have completed in others. Might be useful.)

Hope this helps!

<hr>
Edit: cleaned up a little. :)

[This message was edited by Handor on April 23, 2002 at 09:18.]
 
Status
Not open for further replies.