views:

12

answers:

0

From my experience, when main thread is ready to exit, it should wait until other threads normally exit.

But from this link http://msdn.microsoft.com/en-us/library/ms686722(v=VS.85).aspx, it looks when process is terminated, all related resources are freed, so if certain worker thread is doing heavy work, waiting may be a litter longer. Can I ignore the waiting?

Also in the above link, I find

Do not terminate a process unless its threads are in known states. If a thread is waiting on a kernel object, it will not be terminated until the wait has completed. This can cause the application to hang.

This is too short to understand why killing a thread in unknown states when process exits is wrong.

can someone give me more detail about the problem?

Thanks