cpython/Lib/asyncio
Victor Stinner fe5649c7b7 Python issue #21645, Tulip issue 192: Rewrite signal handling
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.
2014-07-17 22:43:40 +02:00
..
__init__.py asyncio: sync with Tulip, add a new asyncio.coroutines module 2014-06-29 00:46:45 +02:00
base_events.py asyncio: sync with Tulip 2014-07-14 18:33:40 +02:00
base_subprocess.py asyncio: sync with Tulip 2014-07-14 18:33:40 +02:00
constants.py asyncio: Pause accepting whenever accept() returns certain errors. Fixes asyncio issue #78. 2013-11-01 14:12:50 -07:00
coroutines.py asyncio: sync with Tulip 2014-07-11 01:04:16 +02:00
events.py asyncio: sync with Tulip 2014-07-10 22:32:58 +02:00
futures.py Closes #21886, #21447: Fix a race condition in asyncio when setting the result 2014-07-05 15:29:41 +02:00
locks.py asyncio: sync with Tulip, add a new asyncio.coroutines module 2014-06-29 00:46:45 +02:00
log.py Rename the logger to plain "logger". 2013-10-17 15:39:45 -07:00
proactor_events.py Python issue #21645, Tulip issue 192: Rewrite signal handling 2014-07-17 22:43:40 +02:00
protocols.py asyncio: Fix spelling and typos. 2014-02-18 22:27:48 -05:00
queues.py Closes #21886, #21447: Fix a race condition in asyncio when setting the result 2014-07-05 15:29:41 +02:00
selector_events.py Python issue #21645, Tulip issue 192: Rewrite signal handling 2014-07-17 22:43:40 +02:00
streams.py asyncio: sync with Tulip 2014-07-14 18:33:40 +02:00
subprocess.py asyncio, tulip issue 190: Process.communicate() now ignores 2014-07-17 13:12:03 +02:00
tasks.py Issue #21163: Fix "destroy pending task" warning in test_wait_errors() 2014-07-16 18:50:39 +02:00
test_utils.py asyncio tests: make quiet the logs of SSL handshake failures when running tests 2014-07-14 22:26:34 +02:00
transports.py asyncio: WriteTransport.set_write_buffer_size to call _maybe_pause_protocol 2014-02-19 11:10:52 -05:00
unix_events.py Python issue #21645, Tulip issue 192: Rewrite signal handling 2014-07-17 22:43:40 +02:00
windows_events.py asyncio: sync with Tulip 2014-07-12 03:11:53 +02:00
windows_utils.py Issue #21119: asyncio: Make sure that socketpair() close sockets on error 2014-06-04 00:12:28 +02:00