Boost Users :
Subject: Re: [Boost-users] condition_variable::timed_wait doesn't wait
From: tom fogal (tfogal_at_[hidden])
Date: 2009-03-09 14:42:01
Daniele Barzotti <daniele.barzotti_at_[hidden]> writes:
> I'm trying to use condition_variable::timed_wait without success.
> Using the following code, the timed_wait returns immediatly also if
> Receive() is never called.
> Where I wrong?
I haven't used boost's locking mechanisms yet, but POSIX condvars
don't protect against spurious wakes. Thus,
> //wait for an answer..
> bool ready = _cond.timed_wait(lock, xt, boost::lambda::var(_data_ready));
you probably want this in a loop,
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