(self)
| 704 | # Block until the barrier is ready for us, or raise an exception |
| 705 | # if it is broken. |
| 706 | def _enter(self): |
| 707 | while self._state in (-1, 1): |
| 708 | # It is draining or resetting, wait until done |
| 709 | self._cond.wait() |
| 710 | #see if the barrier is in a broken state |
| 711 | if self._state < 0: |
| 712 | raise BrokenBarrierError |
| 713 | assert self._state == 0 |
| 714 | |
| 715 | # Optionally run the 'action' and release the threads waiting |
| 716 | # in the barrier. |