(self)
| 128 | return super().cancelled() |
| 129 | |
| 130 | def _run(self): |
| 131 | # The event loop checks for cancellation without holding the lock |
| 132 | # It is possible that the handle is cancelled after the check |
| 133 | # but before the callback is called so check it again after acquiring |
| 134 | # the lock and return without calling the callback if it is cancelled. |
| 135 | with self._lock: |
| 136 | if self._cancelled: |
| 137 | return |
| 138 | return super()._run() |
| 139 | |
| 140 | |
| 141 | class TimerHandle(Handle): |