(self)
| 740 | # Block until the barrier is ready for us, or raise an exception |
| 741 | # if it is broken. |
| 742 | def _enter(self): |
| 743 | while self._state in (-1, 1): |
| 744 | # It is draining or resetting, wait until done |
| 745 | self._cond.wait() |
| 746 | #see if the barrier is in a broken state |
| 747 | if self._state < 0: |
| 748 | raise BrokenBarrierError |
| 749 | assert self._state == 0 |
| 750 | |
| 751 | # Optionally run the 'action' and release the threads waiting |
| 752 | # in the barrier. |