Boost logo

Boost :

Subject: Re: [boost] [Boost.Interprocess] Chronic performance on Win7
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2011-08-19 19:39:56


El 19/08/2011 22:39, Mathias Gaunard escribió:
> 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);

Thanks for the hint.

Ion


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