Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2006-05-16 06:26:22

Johan Nilsson wrote:

> My guess is that a monotonic timer solution based on QPC/QPF should be
> good enough for at least 90% of all applications.

People (game programmers) have been repeatedly running into problems with
QPC in practice. It may be good enough for 90% of the _cases_, but if your
_application_ depends on QPC for accurate timing, it can break and you may
get a baffling bug report.

>> We don't have a good TIME_MONOTONIC solution, and we really do need
>> one for the threading library.
> I guess the TIME_MONOTONIC stuff would mostly be used for sleep(). As
> there is no way to explicitly make a thread sleep less than the clock
> tick under Windows[*] - why do we need a high-res monotonic counter
> solution for the thread library? Or did I misunderstand you
> (probably)?

We need a monotonic time for condition::wait. It may not be high resolution
(depending on your definition of high), it just needs to work reliably,
which the current xtime implementation does not.

I'm not sure which clock do you mean when you say that a thread can't sleep
for less than a clock tick. If you mean the CPU clock, then yes, a no-op
Sleep function that returns immediately would probably consume more than one
clock tick, so it is impossible to make a thread sleep for less.

Boost list run by bdawes at, gregod at, cpdaniel at, john at