Boost logo

Boost :

Subject: Re: [boost] [Boost.Interprocess] Chronic performance on Win7
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2011-08-19 16:39:32


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);


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk