Document locks.BoundedSemaphore.
This commit is contained in:
parent
3e4a735f15
commit
d2a4a06643
|
@ -171,3 +171,22 @@ multithreaded app.)*
|
|||
|
||||
# Now the semaphore has been released.
|
||||
print("Worker %d is done" % worker_id)
|
||||
|
||||
BoundedSemaphore
|
||||
----------------
|
||||
.. autoclass:: BoundedSemaphore
|
||||
:members:
|
||||
:inherited-members:
|
||||
|
||||
.. testcode::
|
||||
|
||||
sem = locks.BoundedSemaphore()
|
||||
sem.acquire()
|
||||
sem.release()
|
||||
sem.release()
|
||||
|
||||
.. testoutput::
|
||||
|
||||
Traceback (most recent call last):
|
||||
...
|
||||
ValueError: Semaphore released too many times
|
||||
|
|
Loading…
Reference in New Issue