mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-03-04 14:06:13 +08:00
Cygwin: console: Fix interference issue regarding master thread.
- This patch fixes the issue that ReadConsoleInputW() call in the master thread interferes with the input process of non-cygwin apps.
This commit is contained in:
parent
bf9cef4c4e
commit
f9f06a4607
@ -2042,6 +2042,7 @@ class dev_console
|
|||||||
char cons_rabuf[40]; // cannot get longer than char buf[40] in char_command
|
char cons_rabuf[40]; // cannot get longer than char buf[40] in char_command
|
||||||
char *cons_rapoi;
|
char *cons_rapoi;
|
||||||
bool cursor_key_app_mode;
|
bool cursor_key_app_mode;
|
||||||
|
bool disable_master_thread;
|
||||||
|
|
||||||
inline UINT get_console_cp ();
|
inline UINT get_console_cp ();
|
||||||
DWORD con_to_str (char *d, int dlen, WCHAR w);
|
DWORD con_to_str (char *d, int dlen, WCHAR w);
|
||||||
|
@ -208,6 +208,12 @@ fhandler_console::cons_master_thread (handle_set_t *p, tty *ttyp)
|
|||||||
DWORD total_read, n, i;
|
DWORD total_read, n, i;
|
||||||
INPUT_RECORD input_rec[INREC_SIZE];
|
INPUT_RECORD input_rec[INREC_SIZE];
|
||||||
|
|
||||||
|
if (con.disable_master_thread)
|
||||||
|
{
|
||||||
|
cygwait (40);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
WaitForSingleObject (p->input_mutex, INFINITE);
|
WaitForSingleObject (p->input_mutex, INFINITE);
|
||||||
total_read = 0;
|
total_read = 0;
|
||||||
switch (cygwait (p->input_handle, (DWORD) 0))
|
switch (cygwait (p->input_handle, (DWORD) 0))
|
||||||
@ -427,6 +433,7 @@ fhandler_console::setup ()
|
|||||||
con.cons_rapoi = NULL;
|
con.cons_rapoi = NULL;
|
||||||
shared_console_info->tty_min_state.is_console = true;
|
shared_console_info->tty_min_state.is_console = true;
|
||||||
con.cursor_key_app_mode = false;
|
con.cursor_key_app_mode = false;
|
||||||
|
con.disable_master_thread = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -480,6 +487,8 @@ fhandler_console::set_input_mode (tty::cons_mode m, const termios *t,
|
|||||||
flags |= ENABLE_VIRTUAL_TERMINAL_INPUT;
|
flags |= ENABLE_VIRTUAL_TERMINAL_INPUT;
|
||||||
else
|
else
|
||||||
flags |= ENABLE_MOUSE_INPUT;
|
flags |= ENABLE_MOUSE_INPUT;
|
||||||
|
if (shared_console_info)
|
||||||
|
con.disable_master_thread = false;
|
||||||
break;
|
break;
|
||||||
case tty::native:
|
case tty::native:
|
||||||
if (t->c_lflag & ECHO)
|
if (t->c_lflag & ECHO)
|
||||||
@ -492,6 +501,8 @@ fhandler_console::set_input_mode (tty::cons_mode m, const termios *t,
|
|||||||
flags &= ~ENABLE_ECHO_INPUT;
|
flags &= ~ENABLE_ECHO_INPUT;
|
||||||
if (t->c_lflag & ISIG)
|
if (t->c_lflag & ISIG)
|
||||||
flags |= ENABLE_PROCESSED_INPUT;
|
flags |= ENABLE_PROCESSED_INPUT;
|
||||||
|
if (shared_console_info)
|
||||||
|
con.disable_master_thread = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
SetConsoleMode (p->input_handle, flags);
|
SetConsoleMode (p->input_handle, flags);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user