Monday, July 27, 2009

Producer-Consumer using Windows threading

Here is a simple solution to the producer-consumer problem using Windows threading. Basic classes are
  • Producer This is the thread that produces jobs at random intervals
  • Consumer This is the thread that pulls jobs off the messageQueue and processes the job. There are multiple consumers.
  • MessageQueue Fixed size queue to hold the jobs
  • Job Abstract job class that the Consumer consumes
  • Thread Utility class to manage trreads

No comments:

Post a Comment