
19 Aug
2011
19 Aug
'11
8:39 p.m.
On 08/19/2011 12:52 PM, Gav Wood wrote:
The obvious way to gain far higher performance is to Sleep(0). This has had the meaning since Vista of "run any other thread that's ready to run" (it used to mean any other thread of equal priority that's ready to run, hence priority inversion could ensue and people favoured the more aggressively passive Sleep(1)). Changing to a Sleep(0)-based sched_yield gave appropriately speedy results; of the order of 600us for the 1024 roundtrips, about 300ns per forced context switch.
why not instead if(!SwitchToThread()) Sleep(1);