Close the event loop. This clears the queues and shuts down the executor, but does not wait for the executor to finish. The event loop must not be running.
(self)
| 727 | self._stopping = True |
| 728 | |
| 729 | def close(self): |
| 730 | """Close the event loop. |
| 731 | |
| 732 | This clears the queues and shuts down the executor, |
| 733 | but does not wait for the executor to finish. |
| 734 | |
| 735 | The event loop must not be running. |
| 736 | """ |
| 737 | if self.is_running(): |
| 738 | raise RuntimeError("Cannot close a running event loop") |
| 739 | if self._closed: |
| 740 | return |
| 741 | if self._debug: |
| 742 | logger.debug("Close %r", self) |
| 743 | self._closed = True |
| 744 | self._ready.clear() |
| 745 | self._scheduled.clear() |
| 746 | self._executor_shutdown_called = True |
| 747 | executor = self._default_executor |
| 748 | if executor is not None: |
| 749 | self._default_executor = None |
| 750 | executor.shutdown(wait=False) |
| 751 | |
| 752 | def is_closed(self): |
| 753 | """Returns True if the event loop was closed.""" |