By default, wake up one task waiting on this condition, if any. If the calling task has not acquired the lock when this method is called, a RuntimeError is raised. This method wakes up n of the tasks waiting for the condition variable; if fewer than n are waiting, t
(self, n=1)
| 315 | return result |
| 316 | |
| 317 | def notify(self, n=1): |
| 318 | """By default, wake up one task waiting on this condition, if any. |
| 319 | If the calling task has not acquired the lock when this method |
| 320 | is called, a RuntimeError is raised. |
| 321 | |
| 322 | This method wakes up n of the tasks waiting for the condition |
| 323 | variable; if fewer than n are waiting, they are all awoken. |
| 324 | |
| 325 | Note: an awakened task does not actually return from its |
| 326 | wait() call until it can reacquire the lock. Since notify() does |
| 327 | not release the lock, its caller should. |
| 328 | """ |
| 329 | if not self.locked(): |
| 330 | raise RuntimeError('cannot notify on un-acquired lock') |
| 331 | self._notify(n) |
| 332 | |
| 333 | def _notify(self, n): |
| 334 | idx = 0 |