MCPcopy Index your code
hub / github.com/python/cpython / wait

Method wait

Lib/asyncio/locks.py:511–532  ·  view source on GitHub ↗

Wait for the barrier. When the specified number of tasks have started waiting, they are all simultaneously awoken. Returns an unique and individual index number from 0 to 'parties-1'.

(self)

Source from the content-addressed store, hash-verified

509 pass
510
511 async def wait(self):
512 """Wait for the barrier.
513
514 When the specified number of tasks have started waiting, they are all
515 simultaneously awoken.
516 Returns an unique and individual index number from 0 to 'parties-1'.
517 """
518 async with self._cond:
519 await self._block() # Block while the barrier drains or resets.
520 try:
521 index = self._count
522 self._count += 1
523 if index + 1 == self._parties:
524 # We release the barrier
525 await self._release()
526 else:
527 await self._wait()
528 return index
529 finally:
530 self._count -= 1
531 # Wake up any tasks waiting for barrier to drain.
532 self._exit()
533
534 async def _block(self):
535 # Block until the barrier is ready for us,

Callers 8

__aenter__Method · 0.95
test_single_threadMethod · 0.95
test_instrumentationMethod · 0.95
test_trace_concurrentMethod · 0.95

Calls 4

_blockMethod · 0.95
_releaseMethod · 0.95
_waitMethod · 0.95
_exitMethod · 0.95

Tested by 7

test_single_threadMethod · 0.76
test_instrumentationMethod · 0.76
test_trace_concurrentMethod · 0.76