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

Method wait

tools/python-3.11.9-amd64/Lib/threading.py:676–702  ·  view source on GitHub ↗

Wait for the barrier. When the specified number of threads have started waiting, they are all simultaneously awoken. If an 'action' was provided for the barrier, one of the threads will have executed that callback prior to returning. Returns an individual index

(self, timeout=None)

Source from the content-addressed store, hash-verified

674 f" waiters={self.n_waiting}/{self.parties}>")
675
676 def wait(self, timeout=None):
677 """Wait for the barrier.
678
679 When the specified number of threads have started waiting, they are all
680 simultaneously awoken. If an 'action' was provided for the barrier, one
681 of the threads will have executed that callback prior to returning.
682 Returns an individual index number from 0 to 'parties-1'.
683
684 """
685 if timeout is None:
686 timeout = self._timeout
687 with self._cond:
688 self._enter() # Block while the barrier drains.
689 index = self._count
690 self._count += 1
691 try:
692 if index + 1 == self._parties:
693 # We release the barrier
694 self._release()
695 else:
696 # We wait until someone releases us
697 self._wait(timeout)
698 return index
699 finally:
700 self._count -= 1
701 # Wake up any threads waiting for barrier to drain.
702 self._exit()
703
704 # Block until the barrier is ready for us, or raise an exception
705 # if it is broken.

Callers

nothing calls this directly

Calls 4

_enterMethod · 0.95
_releaseMethod · 0.95
_waitMethod · 0.95
_exitMethod · 0.95

Tested by

no test coverage detected