gevent.coros

class gevent.coros.Semaphore

A semaphore manages a counter representing the number of release() calls minus the number of acquire() calls, plus an initial value. The acquire() method blocks if necessary until it can return without making the counter negative.

If not given, value defaults to 1.

This Semaphore’s __exit__ method does not call the trace function.

locked()
release()

Register a callback to call when a counter is more than zero.

callback will be called in the Hub, so it must not use blocking gevent API. callback will be passed one argument: this instance.

Remove the callback set by rawlink()

wait()
acquire()
class gevent.coros.DummySemaphore

A Semaphore initialized with “infinite” initial value. None of its methods ever block.

locked()
release()
wait(timeout=None)
acquire(blocking=True, timeout=None)
class gevent.coros.BoundedSemaphore(value=1)

A bounded semaphore checks to make sure its current value doesn’t exceed its initial value. If it does, ValueError is raised. In most situations semaphores are used to guard resources with limited capacity. If the semaphore is released too many times it’s a sign of a bug.

If not given, value defaults to 1.

release()
class gevent.coros.RLock
acquire(blocking=1)
release()

Related pages