Boost logo

Boost Users :

Subject: Re: [Boost-users] How to implementing a conditional wait
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-02-21 12:11:53


AMDG

Daniele Barzotti wrote:
> while(!data_ready)
> {
> cond.timed_wait(lock, xt);
> }
>
> Ok, The OnDataReceived is called from the SerialPort thread when the
> data is available.
> In the SendCommand I have to wait for a timeout or until the answer is
> arrived...how can I do it?
>

Use the predicate form of timed_wait.

bool ready = cond.timed_wait(lock, xt, boost::lambda::var(data_ready));

In Christ,
Steven Watanabe


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