//------------------------------------------------------------------------ // Filename: // ProducerConsumer.h // PROGRAM DESCRIPTION // definition file for Buffer Monitor class //------------------------------------------------------------------------ #ifndef _PROD_CONS_MON_H #define _PROD_CONS_MON_H #include "ThreadClass.h" #include "ProducerConsumer-Thrd.h" //------------------------------------------------------------------------ // BufferMonitor class definition //------------------------------------------------------------------------ class BufferMonitor : public Monitor { public: BufferMonitor(char* Name); void Put(Item_t item); // add an item into the buffer void Get(Item_t *item); // get an item from the buffer private: Condition NotFull, // wait until buffer is not full NotEmpty; // wait until buffer is not empty int Buffer[BUFFER_SIZE]; // the buffer int In; // next empty slot in the buffer int Out; // next available data slot int NumberOfItems; // number of items in the buffer }; #endif