Wake up the first waiter if it isn't done.
(self)
| 140 | raise RuntimeError('Lock is not acquired.') |
| 141 | |
| 142 | def _wake_up_first(self): |
| 143 | """Wake up the first waiter if it isn't done.""" |
| 144 | if not self._waiters: |
| 145 | return |
| 146 | try: |
| 147 | fut = next(iter(self._waiters)) |
| 148 | except StopIteration: |
| 149 | return |
| 150 | |
| 151 | # .done() necessarily means that a waiter will wake up later on and |
| 152 | # either take the lock, or, if it was cancelled and lock wasn't |
| 153 | # taken already, will hit this again and wake up a new waiter. |
| 154 | if not fut.done(): |
| 155 | fut.set_result(True) |
| 156 | |
| 157 | |
| 158 | class Event(mixins._LoopBoundMixin): |
no test coverage detected