void consumer(
    the_ostream &mos,
    boost::sync_queue<int> & sbq)
{
  using namespace boost;
  try {
    for(int i=0; ;++i)
    {
      int r;
      sbq.pull(r);
      //sbq >> r;
      mos << i << " pull(" << r << ") "<< sbq.size()<<"\n";

      this_thread::sleep_for(chrono::milliseconds(250));
    }
  }
  catch(sync_queue_is_closed&)
  {
    mos << "closed !!!\n";
  }
  catch(...)
  {
    mos << "exception !!!\n";
  }
}
Exemplo n.º 2
0
 ValueType operator()()
 {
   go_->count_down_and_wait();
   return q_->pull();
 }