Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2007-10-18 06:56:23


Johan Nilsson wrote:

> It's possible to handle spurious wakeups with relative times as well,
> perhaps just not perfectly (depending on underlying platform
> support). If
> the only way to perform a timed wait on a condition variable is by an
> absolute time, I believe the most common usage will be something like
> this (pseudocode):
>
> ---
> time now = microsec_clock::local_time();
> time timeout = now + milliseconds(250);
> if (!cv.timed_wait(lk, timeout, my_pred()))
> {
> throw "Timed out!";
> }

You are missing a loop.


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