From 3e9c1988f44653f33ab6faf0c9a67e1dbf28fecf Mon Sep 17 00:00:00 2001 From: cgf Date: Tue, 5 Nov 2002 04:43:01 +0000 Subject: [PATCH] * pinfo.cc (_pinfo::commune_send): Set priority low when sleeping, waiting for commune completion so that we don't spin waiting for lower priority processes. --- winsup/cygwin/ChangeLog | 6 ++++++ winsup/cygwin/pinfo.cc | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 4bffe21693..c6851787e8 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,5 +1,11 @@ 2002-11-04 Christopher Faylor + * pinfo.cc (_pinfo::commune_send): Set priority low when sleeping, + waiting for commune completion so that we don't spin waiting for lower + priority processes. + +2002-11-04 Christopher Faylor + * sigproc.cc (WAIT_SIG_PRIORITY): Bump to THREAD_PRIORITY_TIME_CRITICAL. 2002-11-04 Christopher Faylor diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc index 0f9510fda8..f47e3bd2dd 100644 --- a/winsup/cygwin/pinfo.cc +++ b/winsup/cygwin/pinfo.cc @@ -362,12 +362,17 @@ _pinfo::commune_send (DWORD code) if (sig_send (this, __SIGCOMMUNE)) goto err; + /* FIXME: Need something better than an busy loop here */ bool isalive; while ((isalive = alive ())) if (myself->hello_pid <= 0) break; else - Sleep (0); + { + DWORD prio = SetThreadPriority (GetCurrentThread (), THREAD_PRIORITY_IDLE); + Sleep (0); + SetThreadPriority (GetCurrentThread (), prio); + } CloseHandle (tome); tome = NULL; -- 2.11.0