Beispiel #1
0
void consumer3(the_ostream &mos, boost::sync_queue<int> & sbq)
{
  using namespace boost;
  try {
    for(int i=0; ;++i)
    {
      int r;
      queue_op_status res = sbq.wait_pull_front(r);
      if (res==queue_op_status::closed) break;
      mos << i << " wait_pull_front(" << r << ")\n";
      this_thread::sleep_for(chrono::milliseconds(250));
    }
  }
  catch(...)
  {
    mos << "exception !!!\n";
  }
}
 boost::queue_op_status operator()(ValueType& v)
 {
   go_->wait();
   return q_->wait_pull_front(v);
 }