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