Commit Graph

3 Commits

Author SHA1 Message Date
Yury Selivanov c32c7039cd Fix KeyboardInterrupt handling logic.
When uvloop is run in the main thread we *always* want to set up a
self-pipe and a signal wakeup FD.  That's the only way how libuv
can be notified that a ^C happened and break away from selecting
on sockets.

asyncio does not need to do that, as the 'selectors' module it uses
is already aware of the way Python implements ^C handling.

This translates to a slightly different behavior between asyncio &
uvloop:

1. uvloop needs to always call signal.set_wakeup_fd() when run in the
  main thread;

2. asyncio only needs to call signal.set_wakeup_fd() when a user
  registers a signal handler.

(2) means that if the user had not set up any signals, the signal
wakeup FD stays the same between different asyncio runs.  This commit
fixes uvloop signal implementation to make sure that uvloop behaves
the same way as asyncio in regards to signal wakeup FD between the
loop runs.  It also ensures that uvloop always have a proper
self-pipe set up so that ^C is always supported when it is run in
the main thread.

Issue #295.
2019-10-28 22:53:26 -04:00
Yury Selivanov 5f48dab8fa tests: Support 3.8 2019-10-24 14:42:54 -04:00
Yury Selivanov ce02f94c3d Use new uv_loop_fork API; add a regr test for issue #39. 2017-11-10 12:01:38 -05:00