makefile updates
This commit is contained in:
parent
38443df097
commit
2b113344a3
3 changed files with 14 additions and 4 deletions
|
@ -1,4 +1,9 @@
|
||||||
|
|
||||||
|
#include "BoundedBuffer.h"
|
||||||
|
//#include <stdio>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
void BoundedBuffer::push(string item){
|
void BoundedBuffer::push(string item){
|
||||||
/* if(there is some empty slot){//data.size < b
|
/* if(there is some empty slot){//data.size < b
|
||||||
data.push_back(item);
|
data.push_back(item);
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
#include <semaphore.h>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
@ -7,7 +9,7 @@ unsigned int n = 20, b = 100, w = 5;
|
||||||
|
|
||||||
class BoundedBuffer{
|
class BoundedBuffer{
|
||||||
//int b;
|
//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 *empty = new Semaphore(b); //initialized to b, Since all the slots are empty
|
||||||
Semaphore *mutex = new Semaphore(1);
|
Semaphore *mutex = new Semaphore(1);
|
||||||
|
|
||||||
|
@ -23,7 +25,6 @@ class BoundedBuffer{
|
||||||
|
|
||||||
void pop();
|
void pop();
|
||||||
|
|
||||||
|
|
||||||
//can't be larger than b strings
|
//can't be larger than b strings
|
||||||
//b = user input
|
//b = user input
|
||||||
};
|
};
|
||||||
|
|
8
makefile
8
makefile
|
@ -8,5 +8,9 @@ reqchannel.o: reqchannel.h reqchannel.cpp
|
||||||
dataserver: dataserver.cpp reqchannel.o
|
dataserver: dataserver.cpp reqchannel.o
|
||||||
g++ -std=c++11 -g -o dataserver dataserver.cpp reqchannel.o -lpthread
|
g++ -std=c++11 -g -o dataserver dataserver.cpp reqchannel.o -lpthread
|
||||||
|
|
||||||
simpleclient: simpleclient.cpp reqchannel.o
|
simpleclient: simpleclient.cpp reqchannel.o BoundedBuffer.cpp
|
||||||
g++ -std=c++11 -g -o simpleclient simpleclient.cpp reqchannel.o
|
g++ -std=c++11 -g -o simpleclient simpleclient.cpp reqchannel.o BoundedBuffer.cpp
|
||||||
|
|
||||||
|
clean:
|
||||||
|
$(RM) *.o
|
||||||
|
|
||||||
|
|
Reference in a new issue