MCPcopy Index your code
hub / github.com/python/cpython / release

Method release

Lib/threading.py:522–533  ·  view source on GitHub ↗

Release a semaphore, incrementing the internal counter by one or more. When the counter is zero on entry and another thread is waiting for it to become larger than zero again, wake up that thread.

(self, n=1)

Source from the content-addressed store, hash-verified

520 __enter__ = acquire
521
522 def release(self, n=1):
523 """Release a semaphore, incrementing the internal counter by one or more.
524
525 When the counter is zero on entry and another thread is waiting for it
526 to become larger than zero again, wake up that thread.
527
528 """
529 if n < 1:
530 raise ValueError('n must be one or more')
531 with self._cond:
532 self._value += n
533 self._cond.notify(n)
534
535 def __exit__(self, t, v, tb):
536 self.release()

Callers 1

__exit__Method · 0.95

Calls 1

notifyMethod · 0.45

Tested by

no test coverage detected