Author alegrigoriev
Recipients Chris Billington, alegrigoriev, eryksun, paul.moore, steve.dower, tim.golden, zach.ware
Date 2021-03-03.16:15:32
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>

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.
Date User Action Args
2021-03-03 16:15:32alegrigorievsetrecipients: + alegrigoriev, paul.moore, tim.golden, zach.ware, eryksun, steve.dower, Chris Billington
2021-03-03 16:15:32alegrigorievsetmessageid: <>
2021-03-03 16:15:32alegrigorievlinkissue35935 messages
2021-03-03 16:15:32alegrigorievcreate