From d2a4a0664328a1e48b891911c7eee456be7c59a5 Mon Sep 17 00:00:00 2001 From: "A. Jesse Jiryu Davis" Date: Sat, 4 Apr 2015 08:39:11 -0400 Subject: [PATCH] Document locks.BoundedSemaphore. --- docs/locks.rst | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/docs/locks.rst b/docs/locks.rst index c0ad5005..4f31cb25 100644 --- a/docs/locks.rst +++ b/docs/locks.rst @@ -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