Home | Trees | Indices | Help |
---|
|
object --+ | inverted_semaphore
Inverted semaphore.
An inverted semaphore works very much like a regular semaphore, except threads block _until_ the value reaches zero. For example, if you want a thread to wait for 1 or more events to finish, you can have each event raise the value (always nonblocking) and have your waiter thread call block_till_zero.
The constructor takes one optional parameter, the value to start the semaphore with. It defaults to 0.
|
|||
|
|||
|
|||
|
|||
a new object with type S, a subtype of T |
|
||
|
|||
|
|||
|
|||
Inherited from |
|
|||
_waiting : A fifo of coroutine objects waiting for the semaphore to reach zero. |
|||
value : The value of the inverted semaphore. |
|
|||
Inherited from |
|
|
|
Acquire a number of resource elements. This never blocks.
|
Block until the inverted semaphore reaches zero. This will return immediately if the value is already zero. |
Release a number of resource elements. This never blocks. This may wake up waiting threads.
|
|
_waiting: A fifo of coroutine objects waiting for the semaphore to reach zero. (C only). |
value: The value of the inverted semaphore. Also available via __int__. |
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Thu Feb 16 18:06:44 2012 | http://epydoc.sourceforge.net |