Waiting for Threads to Stop

Aahz Maruch aahz at netcom.com
Thu Jul 20 09:51:40 EDT 2000


In article <lzBd5.7626$IZ1.59773 at iad-read.news.verio.net>,
Doug Fort <dougfort at downright.com> wrote:
>
>I have several cases where I want one thread to wait for one or more other
>threads to terminate.  I've had poor results attempting to spin on isAlive()
>in join().  I'm contemplating  using a  semaphore.  Has anyone got a more
>elegant idiom?

If you're waiting for one thread, that's reasonably easy.  If you're
waiting for all of a group of threads, use a semaphore.  But if you're
waiting for any one of a group of threads, that's a bit more tricky.
I'd suggest waiting on a queue, where the threads dump their data into
the queue.
--
                      --- Aahz (Copyright 2000 by aahz at netcom.com)

Androgynous poly kinky vanilla queer het    <*>     http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6

Q:  In a lesbian relationship, who decides who gets to be the man?
A:  It's two women.  There is no man.  That's the point.



More information about the Python-list mailing list