New submission from Raymond Hettinger <rhettin...@users.sourceforge.net>:

Call sem.release(5) would have the same effect as:

with lock:
    for i in range(5):
         sem.release()

The use case is when a single semaphore is holding up multiple threads and 
needs to release them all.  According to "The Little Book of Semaphores 
<http://greenteapress.com/semaphores/>", this is a common design pattern.

Basic patch attached.  If the proposal meets with acceptance, will add tests 
and a doc update.

----------
components: Library (Lib)
files: sem.diff
keywords: patch
messages: 126804
nosy: rhettinger
priority: normal
severity: normal
status: open
title: Add optional argument to Semaphore.release for releasing multiple threads
type: behavior
versions: Python 3.3
Added file: http://bugs.python.org/file20483/sem.diff

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue10978>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to