Typed characters are mis-ordered when CPU usage is high

Takashi Yano takashi.yano@nifty.ne.jp
Thu Mar 3 00:29:38 GMT 2022


On Wed, 02 Mar 2022 12:28:47 -0800
"Kaz Kylheku wrote:
> On 2022-02-27 06:53, Takashi Yano wrote:
> > I think this is due to a bug which I recently fixed.
> > https://cygwin.com/pipermail/cygwin-patches/2022q1/011791.html
> 
> Was that upstreamed? Sorry to be a pain, but something in the
> log message about the cause and the fix (not just the manifested
> issue being addressed) would be good.
> 
> Reversed characters might mess not only with the user's input,
> but with input coming from terminal emulation, like escape
> sequences, which may be a worse problem.

What do you mean by upstream? The patch was applied the current
cygwin git head (master) and cygwin-3_3-branch. This bug only
affected to the key typed input (user key typing) in console
(e.g. command prompt or Windows Termainal).

If you mean output to the terminal by "input coming from terminal
emulation", that is not affected. If you mean returned escape
sequence such as 'ESC [ 24;1R' against 'ESC [6n', this should not
be affected as well.

The problem was that the console input buffer:
https://docs.microsoft.com/en-us/windows/console/console-input-buffer
could be messed up by the conflict between WriteConsoleInputW()
called in console code (cons_master_thread()) and the keyboard
events comes from user key typing. This has been fixed by checking
the order of the input events in console input buffer after
WriteConsoleInputW() and reordering that if the older events are
placed after newer events.

-- 
Takashi Yano <takashi.yano@nifty.ne.jp>


More information about the Cygwin mailing list