On 3/14/06, Guido van Rossum <guido at python.org> 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.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4