Alexander Grigoriev <alegrigor...@gmail.com> added the comment:

@ericsun:

Windows calls the console event handler in a separate thread. The console event 
handler receives CTRL_C_EVENT, CTRL_BREAK_EVENT, console close, logoff, system 
shutdown events.

Originally, Windows devised an APC mechanism to simulate asynchronous delivery 
of Posix signal to threads. Those APCs are invoked during alertable wait 
functions. Delivery of an APS also aborts the wait with WAIT_IO_COMPLETION 
return code.

An APC can be queued by QueueUserAPC function.

An APC queue can be processed at any time by calling an alertable wait function 
with zero timeout, for example SleepEx(0, TRUE).

If you need an APC to break wait for asynchronous input (like console or serial 
port), use overlapped I/O with GetOverlappedResultEx function. To cancel the 
I/O request, use CancelIo function on the thread which issued the request. Note 
that you still need to wait for the cancelled request to complete the 
cancellation with GetOverlappedResult.

----------
nosy: +alegrigoriev

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue35935>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to