From cfa882572aa35a223df6a3356120f6e3e104292d Mon Sep 17 00:00:00 2001
From: Corinna Vinschen <corinna@vinschen.de>
Date: Sun, 23 Apr 2006 08:39:07 +0000
Subject: [PATCH] 	* select.cc (thread_pipe): Raise sleep time
 dynamically to speed up 	select on pipes when copying lots of data. 
 (thread_mailslot): Ditto for mailslots.

---
 winsup/cygwin/ChangeLog |  7 +++++++
 winsup/cygwin/select.cc | 10 ++++++++--
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 3fd8a78ba..f68265562 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,10 @@
+2006-04-23  Corinna Vinschen  <corinna@vinschen.de>
+	    Christopher Faylor  <cgf@timesys.com>
+
+	* select.cc (thread_pipe): Raise sleep time dynamically to speed up
+	select on pipes when copying lots of data.
+	(thread_mailslot): Ditto for mailslots.
+
 2006-04-22  Christopher Faylor  <cgf@timesys.com>
 
 	* signal.cc (abort): On second thought, just set incyg once.
diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc
index 073e8bcad..970e529f6 100644
--- a/winsup/cygwin/select.cc
+++ b/winsup/cygwin/select.cc
@@ -622,6 +622,7 @@ thread_pipe (void *arg)
 {
   pipeinf *pi = (pipeinf *) arg;
   bool gotone = false;
+  DWORD sleep_time = 0;
 
   for (;;)
     {
@@ -645,7 +646,9 @@ thread_pipe (void *arg)
 	}
       if (gotone)
 	break;
-      Sleep (10);
+      Sleep (sleep_time >> 1);
+      if (sleep_time < 20)
+        ++sleep_time;
     }
 out:
   return 0;
@@ -1634,6 +1637,7 @@ thread_mailslot (void *arg)
 {
   mailslotinf *mi = (mailslotinf *) arg;
   bool gotone = false;
+  DWORD sleep_time = 0;
 
   for (;;)
     {
@@ -1657,7 +1661,9 @@ thread_mailslot (void *arg)
 	}
       if (gotone)
 	break;
-      Sleep (10);
+      Sleep (sleep_time >> 1);
+      if (sleep_time < 20)
+        ++sleep_time;
     }
 out:
   return 0;