Use a shared queue of X items - One thread adds items at random times - The other thread pulls at random times - They need to synchronize when the queue is full (producer) or empty (consumer)!

Auto generated API documentation and code listings for ProducerConsumer

Code

main.cpp [code]