
All I want to do is wait for a specified amount of time for a member variable of my class to equal a certain value.
Can someone please help me with an example?
I've tried several that came from Googling and read the documentation, but I get compile errors no matter what I try.
Currently the compiler is complainging "term does not evaluate to a function taking 0 arguments"
Here is the problem in all its simplicity:
class A { public:
enum STATE { HAPPY = 0, SAD, ANGRY, NUM_STATES };
Foo(boost::posix_time::millisec & timeout) { // I need to wait to return from this until the state is HAPPY
}
private: STATE state_; };
{ unique_lock lock(mutex_); condvar_->timed_wait(lock, timeout, lambda::var(state_) == HAPPY); }