By default, wake up one coroutine waiting on this condition, if any. If the calling coroutine has not acquired the lock when this method is called, a RuntimeError is raised. This method wakes up at most n of the coroutines waiting for the condition variable; it
(self, n=1)
| 296 | return result |
| 297 | |
| 298 | def notify(self, n=1): |
| 299 | """By default, wake up one coroutine waiting on this condition, if any. |
| 300 | If the calling coroutine has not acquired the lock when this method |
| 301 | is called, a RuntimeError is raised. |
| 302 | |
| 303 | This method wakes up at most n of the coroutines waiting for the |
| 304 | condition variable; it is a no-op if no coroutines are waiting. |
| 305 | |
| 306 | Note: an awakened coroutine does not actually return from its |
| 307 | wait() call until it can reacquire the lock. Since notify() does |
| 308 | not release the lock, its caller should. |
| 309 | """ |
| 310 | if not self.locked(): |
| 311 | raise RuntimeError('cannot notify on un-acquired lock') |
| 312 | |
| 313 | idx = 0 |
| 314 | for fut in self._waiters: |
| 315 | if idx >= n: |
| 316 | break |
| 317 | |
| 318 | if not fut.done(): |
| 319 | idx += 1 |
| 320 | fut.set_result(False) |
| 321 | |
| 322 | def notify_all(self): |
| 323 | """Wake up all threads waiting on this condition. This method acts |
no test coverage detected