The Producer class creates an item and stores it in a queue which is supplied via the constructor. The queue is capped (externally) with a max capacity of 10. In the event the queue is full when the producer goes to produce a new item, the calling thread should pend until a spot becomes empty. When items are added to the queue, a signal should be sent to any Consumers that might have been waiting on items.
The Consumer class removes an item from the work queue and dispatches it to a location. The queue is provided to the class via its constructor. If the queue is empty when the consume method is called, the calling thread should pend until an item has been added to the queue. When items are removed form the queue, a signal should be sent to all Producers that may have been waiting for a spot to become open in the queue.
The drive class should contain the call to main and create and start at least two Producers and two Consumers each running in their own threads.
Upon starting, each Producer thread should produce 20 items and each Consumer thread should consume 20 items. Verify exuction occurs without any errors.
Adjust the number of producers and consumers to ensure the queue fills up. Verify no errors occur and that work completes as expected.
Adjust the number of producers and consumers to ensure the queue becomes empty. Verify no errors occur and that work completes as expected.
Submit your solution by pushing all files to the course repo by the deadline.