Waits until all other callers reach the same wait call.
(self)
| 79 | self._condition = threading.Condition() |
| 80 | |
| 81 | def wait(self): |
| 82 | """Waits until all other callers reach the same wait call.""" |
| 83 | self._local_sense.value = not self._flag |
| 84 | with self._lock: |
| 85 | self._counter += 1 |
| 86 | if self._counter == self._num_participants: |
| 87 | self._counter = 0 |
| 88 | self._flag = self._local_sense.value |
| 89 | with self._condition: |
| 90 | while self._flag != self._local_sense.value: |
| 91 | self._condition.wait() |
| 92 | self._condition.notify_all() |
| 93 | |
| 94 | |
| 95 | def _get_num_workers(cluster_spec): |