Boost logo

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-08-21 15:41:24


El 21/08/2013 17:43, Peter Dimov escribió:

> But the timeslice is not necessarily 20ms. A call to timeBeginPeriod(1)
> may shorten it.

timeBeginPeriod seems a bit scary as it affects the general windows
scheduler. One option could be to call GetTickCount until it changes its
value twice (as the resolution of this time is the resolution of the
system timer). Once it changes (after 20-40ms looping, on average that
would me 30ms), then Sleep(1) is called. And for uniprocessor systems we
should avoid doing any loop and call only Sleep(0). But that would be a
really hard to implement spinlock ;-)

Another option is to obtain the a high resolution timestamp each loop
and just loop, say, for 100ms before going to Sleep(1).

Best,

Ion


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