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