On 3/14/06, Guido van Rossum <[EMAIL PROTECTED]> wrote:
> Isn't this a job for threading.BoundedSpemaphore()?

Not sure I see how. What I think Raymond's after (and certainly what I
want) is to queue N tasks, set a counter to N, then wait until the
counter goes to zero.

I suppose

    counter = Semaphore(-N)
    # Queue N tasks
    counter.acquire()

with each task (or the queue) saying

    counter.release()

when it finishes. But the logic seems backwards, and highly prone to
off-by-one errors, and I'm not entirely convinced that a negative
semaphore value is officially supported...

(BoundedSemaphore seems a red herring here - the blocking semantics of
Semaphore and BoundedSemaphore are identical).

Paul.
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to