0

Hi
I have a weather forecasting program that uses a few threads. These threads stop and start at different times throughout the program so there is no set amount of threads at one time. My problem is when i try and close the main thread the program keeps going because there are still threads alive.

Seeing as the threads which are alive change all the time i was wondering if there was any way to kill all threads.

Any help would be greatly appreciated :)

2
Contributors
3
Replies
4
Views
9 Years
Discussion Span
Last Post by jlm699
0

Could your main thread keep a dynamic dictionary or list of the process ids ? Then you could perform some basic system commands to see which theads are still running and kill them if necessary?

0

Well when you fork a new process, the process ID is returned, so you would append that to a list... then when you're ready to quit, iterate through the list issuing system calls to kill each process.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.