Thread-safe circular buffer/queue

Registered by Rick Stovall

Create a class wraps and adapts the boost::circular buffer for use in inter-thread buffering and queuing roles.

Blueprint information

Status:
Complete
Approver:
NRTB Core
Priority:
Essential
Drafter:
Rick Stovall
Direction:
Approved
Assignee:
Rick Stovall
Definition:
Pending Approval
Series goal:
None
Implementation:
Implemented
Milestone target:
None
Started by
Rick Stovall
Completed by
Rick Stovall

Sprints

Whiteboard

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.

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.

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.