Message126804
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. |
|
| Date |
User |
Action |
Args |
| 2011-01-22 00:15:36 | rhettinger | set | recipients:
+ rhettinger |
| 2011-01-22 00:15:36 | rhettinger | set | messageid: <1295655336.58.0.55708711889.issue10978@psf.upfronthosting.co.za> |
| 2011-01-22 00:15:34 | rhettinger | link | issue10978 messages |
| 2011-01-22 00:15:33 | rhettinger | create | |
|