diff --git a/BoundedBuffer.cpp b/BoundedBuffer.cpp index 0447048..0aabdff 100755 --- a/BoundedBuffer.cpp +++ b/BoundedBuffer.cpp @@ -1,4 +1,9 @@ +#include "BoundedBuffer.h" +//#include +#include +#include + void BoundedBuffer::push(string item){ /* if(there is some empty slot){//data.size < b data.push_back(item); diff --git a/BoundedBuffer.h b/BoundedBuffer.h index 5d18136..93086eb 100755 --- a/BoundedBuffer.h +++ b/BoundedBuffer.h @@ -1,5 +1,7 @@ #include +#include +#include using namespace std; @@ -7,7 +9,7 @@ unsigned int n = 20, b = 100, w = 5; class BoundedBuffer{ //int b; - Semaphore *full = new Semaphore(0); //initialized to 0, Since there are 0 full slots + Semaphore full(); //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); @@ -22,7 +24,6 @@ class BoundedBuffer{ void push(string item); void pop(); - //can't be larger than b strings //b = user input diff --git a/makefile b/makefile index 13e1369..106521b 100755 --- a/makefile +++ b/makefile @@ -8,5 +8,9 @@ reqchannel.o: reqchannel.h reqchannel.cpp dataserver: dataserver.cpp reqchannel.o g++ -std=c++11 -g -o dataserver dataserver.cpp reqchannel.o -lpthread -simpleclient: simpleclient.cpp reqchannel.o - g++ -std=c++11 -g -o simpleclient simpleclient.cpp reqchannel.o +simpleclient: simpleclient.cpp reqchannel.o BoundedBuffer.cpp + g++ -std=c++11 -g -o simpleclient simpleclient.cpp reqchannel.o BoundedBuffer.cpp + +clean: + $(RM) *.o +