Single queue of a single producer with a "blocking" of pop music

I am looking for a single queue of one producer with a "blocking" of pop music. Boost spsc_queue is almost excellent, except for one method:

bool pop(T & ret);
Pops one object from ringbuffer.

This method is non-blocking and returns immediately if there is no data. I want this method to “block” and wait for some data to appear.

What collections should I use?

upd At least someone can offer any C ++ queue with pop blocking?

+4
source share
1 answer

-: , .

queue::pop, - :

bool blocking_pop(T & t) {
  while(!queue.empty())
    wait();
  return queue.pop(t);
}

Intel TBB tbb::concurrent_bounded_queue, .

0

All Articles