| 556 | self._cond.notify_all() |
| 557 | |
| 558 | async def _wait(self): |
| 559 | # Wait in the barrier until we are released. Raise an exception |
| 560 | # if the barrier is reset or broken. |
| 561 | |
| 562 | # wait for end of filling |
| 563 | # unless a CancelledError occurs |
| 564 | await self._cond.wait_for(lambda: self._state is not _BarrierState.FILLING) |
| 565 | |
| 566 | if self._state in (_BarrierState.BROKEN, _BarrierState.RESETTING): |
| 567 | raise exceptions.BrokenBarrierError("Abort or reset of barrier") |
| 568 | |
| 569 | def _exit(self): |
| 570 | # If we are the last tasks to exit the barrier, signal any tasks |