Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2011-07-07 10:21:24 +0400
committerCorinna Vinschen <corinna@vinschen.de>2011-07-07 10:21:24 +0400
commit66965620fc9cf7102d4e3daf7e7e18f658e16e08 (patch)
tree6da41770a42a9205c95623441a0145b7d62c7185 /winsup/cygwin
parent57e64035f8426c86dd211c5246bbde426deb6a09 (diff)
* miscfuncs.cc (yield): Drop thread priority only once.
Diffstat (limited to 'winsup/cygwin')
-rw-r--r--winsup/cygwin/ChangeLog4
-rw-r--r--winsup/cygwin/miscfuncs.cc6
2 files changed, 7 insertions, 3 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 397436469..da03f8b25 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,7 @@
+2011-07-07 Corinna Vinschen <corinna@vinschen.de>
+
+ * miscfuncs.cc (yield): Drop thread priority only once.
+
2011-07-06 Christopher Faylor <me.cygwin2011@cgf.cx>
* exceptions.cc (_cygtls::interrupt_now): Back out previous change
diff --git a/winsup/cygwin/miscfuncs.cc b/winsup/cygwin/miscfuncs.cc
index d293edea9..14d67789f 100644
--- a/winsup/cygwin/miscfuncs.cc
+++ b/winsup/cygwin/miscfuncs.cc
@@ -239,17 +239,17 @@ check_iovec (const struct iovec *iov, int iovcnt, bool forwrite)
void
yield ()
{
+ int prio = GetThreadPriority (GetCurrentThread ());
+ SetThreadPriority (GetCurrentThread (), THREAD_PRIORITY_IDLE);
for (int i = 0; i < 2; i++)
{
- int prio = GetThreadPriority (GetCurrentThread ());
- SetThreadPriority (GetCurrentThread (), THREAD_PRIORITY_IDLE);
/* MSDN implies that SleepEx(0,...) will force scheduling of other
threads. Unlike SwitchToThread() the documentation does not mention
other cpus so, presumably (hah!), this + using a lower priority will
stall this thread temporarily and cause another to run. */
SleepEx (0, false);
- SetThreadPriority (GetCurrentThread (), prio);
}
+ SetThreadPriority (GetCurrentThread (), prio);
}
/* Get a default value for the nice factor. When changing these values,