two questions about thread

Bryan Olson fakeaddress at
Mon Jan 16 22:39:43 CET 2006

Kevin wrote:
> The best way to do this is by using a flag or event that the child-threads
> monitor each loop (or multiple times per loop if it's a long loop).  If the
> flag is set, they exit themselves.
> The parent thread only has to set the flag to cause the children to die.

Doesn't work, because threads can be blocked. Worse,
some threads may be blocked waiting for others to release
them. The unblocked threads check the flag and exit, so
they're never signal the blocked ones.


More information about the Python-list mailing list