An arbitrary number of producer threads place random number in a bounded buffer, and an arbitrary number of consumer threads remove items from the buffer, determining if the numbers are prime.
Initially intended to be a simple example of the difficulties involved with a producer/consumer problem, and the care that should be taken when initializing producer/consumer threads, this quickly became a pet project to come up with a solution that will run successfully, even with an infinitely unbalanced number of with an infinitely unbalanced number of producers and consumers.
Written in C++ 11 for Unix systems.