Boost logo

Boost Users :

From: Terry G (tjgolubi_at_[hidden])
Date: 2008-03-28 15:46:03


I usually do something like this for that sort of problem.
terry

boost::mutex Mutex;
boost::condition Condition;
bool Signalled;

void Thread1() {
  MyCode::CreateThread2();
  boost::mutex::scoped_lock l(Mutex);
  Signalled = false;
  while (!Signalled)
     Condition.timed_wait(l, make500msdelay());
} // Thread1

void Thread2() {
  mutex::scoped_lock(Mutex);
  Signalled = true;
  Condition.notify_all();
} // Thread2


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