summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/pinfo.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2002-11-05 04:43:02 +0000
committerChristopher Faylor <me@cgf.cx>2002-11-05 04:43:02 +0000
commitd2637322384d97148007decb03d4af6f87159752 (patch)
tree6a38c7199d025cfa5054b7bf21bb17b8a369e79c /winsup/cygwin/pinfo.cc
parent73f7245be241129f9fe50a06f88e0d271ad6aac7 (diff)
downloadcygnal-d2637322384d97148007decb03d4af6f87159752.tar.gz
cygnal-d2637322384d97148007decb03d4af6f87159752.tar.bz2
cygnal-d2637322384d97148007decb03d4af6f87159752.zip
* 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.
Diffstat (limited to 'winsup/cygwin/pinfo.cc')
-rw-r--r--winsup/cygwin/pinfo.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc
index 0f9510fda..f47e3bd2d 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;