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: select: Improve select/poll response.
Date: Tue, 14 Sep 2021 15:05:09 +0000 (GMT)	[thread overview]
Message-ID: <20210914150509.10AAA3857800@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=b75d855fb03df2cb4a000f609be047f467942557

commit b75d855fb03df2cb4a000f609be047f467942557
Author: Takashi Yano <takashi.yano@nifty.ne.jp>
Date:   Fri Aug 27 19:54:41 2021 +0900

    Cygwin: select: Improve select/poll response.

Diff:
---
 winsup/cygwin/select.cc | 32 ++++++++++++++++++++++++++++----
 1 file changed, 28 insertions(+), 4 deletions(-)

diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc
index 8ad982c12..83e1c00e0 100644
--- a/winsup/cygwin/select.cc
+++ b/winsup/cygwin/select.cc
@@ -735,6 +735,7 @@ thread_pipe (void *arg)
   select_pipe_info *pi = (select_pipe_info *) arg;
   DWORD sleep_time = 0;
   bool looping = true;
+  DWORD t0 = GetTickCount ();
 
   while (looping)
     {
@@ -754,7 +755,12 @@ thread_pipe (void *arg)
 	break;
       cygwait (pi->bye, sleep_time >> 3);
       if (sleep_time < 80)
-	++sleep_time;
+	{
+	  DWORD t1 = GetTickCount ();
+	  if (t0 != t1)
+	    ++sleep_time;
+	  t0 = t1;
+	}
       if (pi->stop_thread)
 	break;
     }
@@ -930,6 +936,7 @@ thread_fifo (void *arg)
   select_fifo_info *pi = (select_fifo_info *) arg;
   DWORD sleep_time = 0;
   bool looping = true;
+  DWORD t0 = GetTickCount ();
 
   while (looping)
     {
@@ -949,7 +956,12 @@ thread_fifo (void *arg)
 	break;
       cygwait (pi->bye, sleep_time >> 3);
       if (sleep_time < 80)
-	++sleep_time;
+	{
+	  DWORD t1 = GetTickCount ();
+	  if (t0 != t1)
+	    ++sleep_time;
+	  t0 = t1;
+	}
       if (pi->stop_thread)
 	break;
     }
@@ -1125,6 +1137,7 @@ thread_console (void *arg)
   select_console_info *ci = (select_console_info *) arg;
   DWORD sleep_time = 0;
   bool looping = true;
+  DWORD t0 = GetTickCount ();
 
   while (looping)
     {
@@ -1144,7 +1157,12 @@ thread_console (void *arg)
 	break;
       cygwait (ci->bye, sleep_time >> 3);
       if (sleep_time < 80)
-	++sleep_time;
+	{
+	  DWORD t1 = GetTickCount ();
+	  if (t0 != t1)
+	    ++sleep_time;
+	  t0 = t1;
+	}
       if (ci->stop_thread)
 	break;
     }
@@ -1364,6 +1382,7 @@ thread_pty_slave (void *arg)
   select_pipe_info *pi = (select_pipe_info *) arg;
   DWORD sleep_time = 0;
   bool looping = true;
+  DWORD t0 = GetTickCount ();
 
   while (looping)
     {
@@ -1383,7 +1402,12 @@ thread_pty_slave (void *arg)
 	break;
       cygwait (pi->bye, sleep_time >> 3);
       if (sleep_time < 80)
-	++sleep_time;
+	{
+	  DWORD t1 = GetTickCount ();
+	  if (t0 != t1)
+	    ++sleep_time;
+	  t0 = t1;
+	}
       if (pi->stop_thread)
 	break;
     }


                 reply	other threads:[~2021-09-14 15:05 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=20210914150509.10AAA3857800@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: link
Be 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).