PyDocs

Nav

Concurrent Execution

Semaphore

threading

class (source) not WASI
  • Semaphore(value=1)
This class implements semaphore objects.

Semaphores manage 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.
Changed in 3.3
  • 3.3: changed from a factory function to a class.
Members of Semaphore

a

acquire
Acquire a semaphore, decrementing the internal counter by one.

r

release
Release a semaphore, incrementing the internal counter by one or more.
0 Examples
No examples for threading/Semaphore.
See Also
No see-alsos for threading/Semaphore
0 Notes
No notes for Semaphore