Boost logo

Boost :

From: Johan Nilsson (r.johan.nilsson_at_[hidden])
Date: 2007-10-18 07:22:01


Peter Dimov wrote:
> 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.

I think you're missing the predicate "my_pred()".

/ Johan


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