kill pthread

Hi every one:
I have a newbie question about killing a pthread..

Assume that, I have thread A, A creates some child threads using pthread_create(). The problem is, thread A can crash at anytime, and what I want is other children threads of thread A must stop running when thread A crashes. How can I achieve that? How do other threads know if thread A crashes?

Note: What I mean is kill all threads when thread A CRASHES, not finish running.

thank you very much!!
closed account (S6k9GNh0)
Set a global flag and check every now and then? You can also use signals (as in boost::signal2) instead but it might be a bit more complex.
Last edited on
In UNIX, if any thread of a program ends abnormally, the entire process dies, all threads with it.
Topic archived. No new replies allowed.