BlockingCollection is a C++11 thread safe collection class that provides the following features:
- Implementation of classic Producer/Consumer pattern (i.e. condition variable, mutex);
- Concurrent adding and taking of items from multiple threads.
- Optional maximum capacity.
- Insertion and removal operations that block when collection is empty or full.
- Insertion and removal "try" operations that do not block or that block up to a specified period of time.
- Insertion and removal 'bulk" operations that allow more than one element to be added or taken at once.
- Priority-based insertion and removal operations.
- Encapsulates any collection type that satisfy the ProducerConsumerCollection requirement.
- Minimizes sleeps, wake ups and lock contention by managing an active subset of producer and consumer threads.
- Pluggable condition variable and lock types.
- Range-based loop support.
https://github.com/CodeExMachina/BlockingCollection