Title: asyncio should use signal.set_wakeup_fd on Windows
Type: behavior Stage: needs patch
Components: Library (Lib) Versions: Python 3.8, Python 3.7, Python 3.6
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: asvetlov, giampaolo.rodola, njs, vstinner, yselivanov
Priority: normal Keywords:

Created on 2018-03-31 22:44 by njs, last changed 2018-04-01 23:35 by pitrou.

Messages (1)
msg314749 - (view) Author: Nathaniel Smith (njs) * (Python committer) Date: 2018-03-31 22:44
I thought there was already a bug for this, but it came up in conversation again and I can't find one, so, here you go...

It looks like originally there was this bug for making control-C wake up the asyncio event loop in Windows:

This required some changes to signal.set_wakeup_fd to work on Windows, which was done in bpo-22018.

But I guess the last step got lost in the shuffle: right now signal.set_wakeup_fd works fine on Windows, but asyncio doesn't actually use it. This means that on Windows you can't wake up this program using control-C:

>>> import asyncio

Both of the Windows event loops should register a wakeup socket with signal.set_wakeup_fd, and arrange for the loop to wake up when data arrives on that socket, and read from it until it's empty again. (And once the loop is awake, Python's normal control-C handling will kick in.) That will make control-C on Windows work similarly to how it does on Unix.
Date User Action Args
2018-04-01 23:35:09pitrousettype: behavior
components: + Library (Lib)
stage: needs patch
2018-03-31 22:44:55njscreate