A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2006-March/062390.html below:

[Python-Dev] Another threading idea

[Python-Dev] Another threading idea [Python-Dev] Another threading ideaPaul Moore p.f.moore at gmail.com
Tue Mar 14 23:28:26 CET 2006
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.
More information about the Python-Dev mailing list

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