
9 Mar
2009
9 Mar
'09
6:42 p.m.
Daniele Barzotti
Hi! 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. [snip] Where I wrong?
I haven't used boost's locking mechanisms yet, but POSIX condvars don't protect against spurious wakes. Thus, [snip]
//wait for an answer.. bool ready = _cond.timed_wait(lock, xt, boost::lambda::var(_data_ready));
you probably want this in a loop, while(!_data_ready) { _cond.timed_wait(... _data_ready); } HTH, -tom