diff options
Diffstat (limited to 'winsup/cygwin/miscfuncs.cc')
-rw-r--r-- | winsup/cygwin/miscfuncs.cc | 6 |
1 files changed, 3 insertions, 3 deletions
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, |