Boost logo

Boost Users :

From: Pavel Syomin (syomin_at_[hidden])
Date: 2006-09-21 02:51:43


Hi!
> Alternatively, you can avoid the need to explicitly use a while loop by
> calling the overloaded version of timed_wait() that takes a predicate
> argument. This version does the loop for you internally. E.g.:
>
> if (!(m_condition.timed_wait (lock, time, boost::bind<int>
> (boost::mem_fn (&AsyncQueue::m_counter), this))))
> return;
>
Thank you! I saw overloaded version of timed_wait() but didn't
understand its purpose.
> On a separate point, there is a bug in your usage of the xtime struct in
> main():
>
> xtime_get(&time, TIME_UTC);
> time.nsec += 10000;
> queue.timed_pop(time);
>
> You cannot simply add a value to time.nsec and then use the struct,
> because nsec is required to be in the range [0,999999999].
In really code I use sec, not nsec. But you are rigth.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net