|
Boost Users : |
Subject: Re: [Boost-users] condition_variable::timed_wait doesn't wait
From: Roman Perepelitsa (roman.perepelitsa_at_[hidden])
Date: 2009-03-10 04:09:07
2009/3/9 tom fogal <tfogal_at_[hidden]>
> 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);
> }
>
timed_wait with predicate (that's what OP used) does exactly this, it waits
on condvar until predicate is satisfied. So problem is in some other place.
Roman.
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