ID EN
Threading

Semaphore

Python 3.11

This class implements semaphore objects. A semaphore manages an atomic 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.

Syntax

PYTHON
class threading.Semaphore(value=1)

See Also

release() acquire() acquire() ValueError release() release()