#ifndef _BoundedBuffer_H_ #define _BoundedBuffer_H_ #include #include //#include using namespace std; //extern unsigned int n, b, w; class BoundedBuffer{ Semaphore *full = new Semaphore(0); //initialized to 0, Since there are 0 full slots Semaphore *empty;// = new Semaphore(b); //initialized to b, Since all the slots are empty Semaphore *mutex = new Semaphore(1); vector data; public: BoundedBuffer(){empty = new Semaphore(200);}//default b value BoundedBuffer(int b){ empty = new Semaphore(b); } void set_empty(int e){empty = new Semaphore(e);} void push(string item); string pop(); //can't be larger than b strings //b = user input }; #endif