Message362668
Damn, good catch. How about the following idea - register a normal signal handler (using signal.signal) that does something like:
def sigint_handler():
get_running_loop().interrupt()
# in class BaseEventLoop
def interrupt(self):
# Might be a generally useful thread-safe way to interrupt a loop
if self._is_inside_callback():
_thread.interrupt_main() # All this behavior is only relevant to the main thread anyway
else:
self._interrupted = True
And inside BaseEventLoop._run_once() add the following check:
# in class BaseEventLoop
def _check_interrupted(self):
# This will be called by BaseEventLoop._run_once() before calling select,
# and before popping any handle from the ready queue
if self._interrupted:
raise KeyboardInterrupt |
|
Date |
User |
Action |
Args |
2020-02-25 22:35:29 | kmaork | set | recipients:
+ kmaork, asvetlov, yselivanov, Zhibin Dong |
2020-02-25 22:35:29 | kmaork | set | messageid: <1582670129.25.0.480180574915.issue39622@roundup.psfhosted.org> |
2020-02-25 22:35:29 | kmaork | link | issue39622 messages |
2020-02-25 22:35:29 | kmaork | create | |
|