|
Boost : |
Subject: Re: [boost] [Boost.Interprocess] conditions variables get 10 times faster when opening a multiprocess browser
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2013-09-08 14:17:10
El 08/09/2013 7:39, Gottlob Frege escribió:
> I haven't looked at the code, but I see mention of Sleep(0) here. Does
> everyone realize the special behavior of Sleep(0) ?
>
> It only gives up a timeslice to threads of >= priority. Starving lower
> priority threads (if you were to spin with only that).
Yes we take in care this Sleep(0) behaviour. In fact Sleep was changed
starting with Windows Server 2003 and now it can relinquish the
remainder of its time slice to any other thread that is ready to run.
The code uses a combination of SwitchToThread + Sleep(0) plus Sleep(1)
to avoid starvation.
Best,
Ion
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk