* miscfuncs.cc (yield): Drop thread priority only once.
This commit is contained in:
parent
57e64035f8
commit
66965620fc
@ -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>
|
2011-07-06 Christopher Faylor <me.cygwin2011@cgf.cx>
|
||||||
|
|
||||||
* exceptions.cc (_cygtls::interrupt_now): Back out previous change
|
* exceptions.cc (_cygtls::interrupt_now): Back out previous change
|
||||||
|
@ -239,17 +239,17 @@ check_iovec (const struct iovec *iov, int iovcnt, bool forwrite)
|
|||||||
void
|
void
|
||||||
yield ()
|
yield ()
|
||||||
{
|
{
|
||||||
|
int prio = GetThreadPriority (GetCurrentThread ());
|
||||||
|
SetThreadPriority (GetCurrentThread (), THREAD_PRIORITY_IDLE);
|
||||||
for (int i = 0; i < 2; i++)
|
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
|
/* MSDN implies that SleepEx(0,...) will force scheduling of other
|
||||||
threads. Unlike SwitchToThread() the documentation does not mention
|
threads. Unlike SwitchToThread() the documentation does not mention
|
||||||
other cpus so, presumably (hah!), this + using a lower priority will
|
other cpus so, presumably (hah!), this + using a lower priority will
|
||||||
stall this thread temporarily and cause another to run. */
|
stall this thread temporarily and cause another to run. */
|
||||||
SleepEx (0, false);
|
SleepEx (0, false);
|
||||||
SetThreadPriority (GetCurrentThread (), prio);
|
|
||||||
}
|
}
|
||||||
|
SetThreadPriority (GetCurrentThread (), prio);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get a default value for the nice factor. When changing these values,
|
/* Get a default value for the nice factor. When changing these values,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user