title: boost thread notify_all() and sleep()
body: <pre><code>boost::condition_variable cond;
  boost::mutex mut;
  bool ready = false;
  
  void consumer() {
      boost::mutex::scoped_lock lock(mut);
      while (!ready) {
           cond.wait(lock);
      }
  }
  
  void producer() {
      boost::mutex::scoped_lock lock(mut);
      ready = true;
      cond.notify_all();
      boost::this_thread::sleep(boost::posix_time::seconds(4));
  }
  </code></pre>
  
  <p>Refer to the above code, I actually sleep the producer thread for 4 seconds after I call notify_all(). However, the consumer threads are actually woken up after 4 seconds. So how can I get around this and wake up the consumer threads immediately after I call notify_all() despite the 4 seconds sleep. Thanks in advance.</p>