MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / release

Method release

tools/python-3.11.9-amd64/Lib/threading.py:531–548  ·  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

(self, n=1)

Source from the content-addressed store, hash-verified

529 f" value={self._value}/{self._initial_value}>")
530
531 def release(self, n=1):
532 """Release a semaphore, incrementing the internal counter by one or more.
533
534 When the counter is zero on entry and another thread is waiting for it
535 to become larger than zero again, wake up that thread.
536
537 If the number of releases exceeds the number of acquires,
538 raise a ValueError.
539
540 """
541 if n < 1:
542 raise ValueError('n must be one or more')
543 with self._cond:
544 if self._value + n > self._initial_value:
545 raise ValueError("Semaphore released too many times")
546 self._value += n
547 for i in range(n):
548 self._cond.notify()
549
550
551class Event:

Callers

nothing calls this directly

Calls 1

notifyMethod · 0.45

Tested by

no test coverage detected