(self, timeout=None)
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 number from 0 to 'parties-1'.
Wait for the barrier.
Wait for the barrier .
def wait(self, timeout=None):
        """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 number from 0 to 'parties-1'.

        """
        if timeout is None:
            timeout = self._timeout
        with self._cond:
            self._enter() # Block while the barrier drains.
            index = self._count
            self._count += 1
            try:
                if index + 1 == self._parties:
                    # We release the barrier
                    self._release()
                else:
                    # We wait until someone releases us
                    self._wait(timeout)
                return index
            finally:
                self._count -= 1
                # Wake up any threads waiting for barrier to drain.
                self._exit()
def wait ( self , timeout = None ) : if timeout is None : timeout = self . _timeout with self . _cond : self . _enter ( ) # Block while the barrier drains. index = self . _count self . _count += 1 try : if index + 1 == self . _parties : # We release the barrier self . _release ( ) else : # We wait until someone releases us self . _wait ( timeout ) return index finally : self . _count -= 1 # Wake up any threads waiting for barrier to drain. self . _exit ( )