MCPcopy Index your code
hub / github.com/RustPython/RustPython / release

Method release

Lib/threading.py:572–588  ·  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. If the number of releases exceeds the number of acquires, raise a Val

(self, n=1)

Source from the content-addressed store, hash-verified

570 f" value={self._value}/{self._initial_value}>")
571
572 def release(self, n=1):
573 """Release a semaphore, incrementing the internal counter by one or more.
574
575 When the counter is zero on entry and another thread is waiting for it
576 to become larger than zero again, wake up that thread.
577
578 If the number of releases exceeds the number of acquires,
579 raise a ValueError.
580
581 """
582 if n < 1:
583 raise ValueError('n must be one or more')
584 with self._cond:
585 if self._value + n > self._initial_value:
586 raise ValueError("Semaphore released too many times")
587 self._value += n
588 self._cond.notify(n)
589
590
591class Event:

Callers

nothing calls this directly

Calls 1

notifyMethod · 0.45

Tested by

no test coverage detected