mirror of
https://github.com/python/cpython.git
synced 2025-11-03 03:22:27 +00:00
Since Python 3.3, the C signal handler writes the signal number into the wakeup file descriptor and then schedules the Python call using Py_AddPendingCall(). asyncio uses the wakeup file descriptor to wake up the event loop, and relies on Py_AddPendingCall() to schedule the final callback with call_soon(). If the C signal handler is called in a thread different than the thread of the event loop, the loop is awaken but Py_AddPendingCall() was not called yet. In this case, the event loop has nothing to do and go to sleep again. Py_AddPendingCall() is called while the event loop is sleeping again and so the final callback is not scheduled immediatly. This patch changes how asyncio handles signals. Instead of relying on Py_AddPendingCall() and the wakeup file descriptor, asyncio now only relies on the wakeup file descriptor. asyncio reads signal numbers from the wakeup file descriptor to call its signal handler. |
||
|---|---|---|
| .. | ||
| __init__.py | ||
| __main__.py | ||
| echo.py | ||
| echo2.py | ||
| echo3.py | ||
| keycert3.pem | ||
| pycacert.pem | ||
| ssl_cert.pem | ||
| ssl_key.pem | ||
| test_base_events.py | ||
| test_events.py | ||
| test_futures.py | ||
| test_locks.py | ||
| test_proactor_events.py | ||
| test_queues.py | ||
| test_selector_events.py | ||
| test_streams.py | ||
| test_subprocess.py | ||
| test_tasks.py | ||
| test_transports.py | ||
| test_unix_events.py | ||
| test_windows_events.py | ||
| test_windows_utils.py | ||