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

Method wait

Lib/threading.py:719–745  ·  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 numbe

(self, timeout=None)

Source from the content-addressed store, hash-verified

717 f" waiters={self.n_waiting}/{self.parties}>")
718
719 def wait(self, timeout=None):
720 """Wait for the barrier.
721
722 When the specified number of threads have started waiting, they are all
723 simultaneously awoken. If an 'action' was provided for the barrier, one
724 of the threads will have executed that callback prior to returning.
725 Returns an individual index number from 0 to 'parties-1'.
726
727 """
728 if timeout is None:
729 timeout = self._timeout
730 with self._cond:
731 self._enter() # Block while the barrier drains.
732 index = self._count
733 self._count += 1
734 try:
735 if index + 1 == self._parties:
736 # We release the barrier
737 self._release()
738 else:
739 # We wait until someone releases us
740 self._wait(timeout)
741 return index
742 finally:
743 self._count -= 1
744 # Wake up any threads waiting for barrier to drain.
745 self._exit()
746
747 # Block until the barrier is ready for us, or raise an exception
748 # 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