public inbox for cygwin-cvs@sourceware.org help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org> To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: pty: Revise the code for timeout in term_has_pcon_cap(). Date: Mon, 14 Dec 2020 10:02:50 +0000 (GMT) [thread overview] Message-ID: <20201214100250.57CB1386EC75@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=55eff668b878fe6571cd363a4ce80dd0b1d718da commit 55eff668b878fe6571cd363a4ce80dd0b1d718da Author: Takashi Yano via Cygwin-patches <cygwin-patches@cygwin.com> Date: Mon Dec 14 17:26:09 2020 +0900 Cygwin: pty: Revise the code for timeout in term_has_pcon_cap(). - Sometimes timeout period in term_has_pcon_cap() may not be enough when the machine slows down for some reason. This patch eases the issue. In the new code, effective timeout period is expected to be extended as a result due to slowing-down the wait loop as well when the machine gets into busy. Diff: --- winsup/cygwin/fhandler_tty.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc index 845e51184..04a9a2bf5 100644 --- a/winsup/cygwin/fhandler_tty.cc +++ b/winsup/cygwin/fhandler_tty.cc @@ -2651,7 +2651,7 @@ fhandler_pty_slave::term_has_pcon_cap (const WCHAR *env) char *p; int len; int x1, y1, x2, y2; - DWORD t0; + int wait_cnt = 0; /* Check if terminal has ANSI escape sequence. */ if (!has_ansi_escape_sequences (env)) @@ -2668,7 +2668,6 @@ fhandler_pty_slave::term_has_pcon_cap (const WCHAR *env) ReleaseMutex (input_mutex); p = buf; len = sizeof (buf) - 1; - t0 = GetTickCount (); do { if (::bytes_available (n, get_handle ()) && n) @@ -2680,9 +2679,10 @@ fhandler_pty_slave::term_has_pcon_cap (const WCHAR *env) char *p1 = strrchr (buf, '\033'); if (p1 == NULL || sscanf (p1, "\033[%d;%dR", &y1, &x1) != 2) continue; + wait_cnt = 0; break; } - else if (GetTickCount () - t0 > 40) /* Timeout */ + else if (++wait_cnt > 100) /* Timeout */ goto not_has_csi6n; else Sleep (1);
reply other threads:[~2020-12-14 10:02 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20201214100250.57CB1386EC75@sourceware.org \ --to=corinna@sourceware.org \ --cc=cygwin-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).