Using Producer-Consumer Queues
The concept of producer-consumer synchronization was introduced in Using Condition Variables. This form of synchronization can be used to coordinate communication between two or more threads. By combining producer-consumer synchronization semantics with a simple templatized queue, you can link threads together into a network of cooperating processing elements.
For more information on producer-consumer synchronization, see The Producer‑Consumer Classes.