nrtb-core team mailing list archive
-
nrtb-core team
-
Mailing list archive
-
Message #00304
[Blueprint nrtb-circular-queue] Thread-safe circular buffer/queue
Blueprint changed by Rick Stovall:
Whiteboard changed:
The new circular_queue template class will in the nrtb_common lib and will provide the following interface:
- constructor and destructor
- push // put in the queue
- pull // get from the queue
- park // blocks the calling thread until there is data to be processed, returns a queue item.
- clear // clears the queue
- resize // sets the queue size
- size // returns the number of elements in the queue.
+ constructor and destructor
+ push // put in the queue
+ pull // get from the queue
+ park // blocks the calling thread until there is data to be processed, returns a queue item.
+ clear // clears the queue
+ resize // sets the queue size
+ size // returns the number of elements in the queue.
+
+ Also include a linear_queue template which has the same interface as
+ above without the resize method. The linear queue is a bit slower, but
+ will expand as needed to handle the load.
+
+ Circular queue is best suited for tight, high speed links between
+ threads where you can reasonably predict the high-water marks, while
+ linear queue is better suited where speed is less important and the
+ queue may need to grow.
--
Thread-safe circular buffer/queue
https://blueprints.launchpad.net/nrtb/+spec/nrtb-circular-queue