Ensure that the first waiter will wake up.
(self)
| 163 | raise RuntimeError("Lock is not acquired") |
| 164 | |
| 165 | def _wake_up_first(self) -> None: |
| 166 | """Ensure that the first waiter will wake up.""" |
| 167 | if not self._waiters: |
| 168 | return |
| 169 | try: |
| 170 | fut = next(iter(self._waiters)) |
| 171 | except StopIteration: |
| 172 | return |
| 173 | |
| 174 | # .done() means that the waiter is already set to wake up. |
| 175 | if not fut.done(): |
| 176 | fut.set_result(True) |
| 177 | |
| 178 | |
| 179 | class Condition(_ContextManagerMixin, _LoopBoundMixin): |