fix
This commit is contained in:
parent
b9476e9db1
commit
1e1a03c104
2 changed files with 4 additions and 24 deletions
|
@ -12,28 +12,13 @@ void BoundedBuffer::push(string item){
|
|||
full->V();//increment the number of full slots now.
|
||||
}
|
||||
|
||||
string BoundedBuffer::pop(){
|
||||
<<<<<<< HEAD
|
||||
if(data.size() > 0){
|
||||
full->P();
|
||||
mutex->P();
|
||||
string item = data.back();
|
||||
data.pop_back();
|
||||
mutex->V();
|
||||
empty->V();
|
||||
return item;
|
||||
}else{
|
||||
return "quit";
|
||||
}
|
||||
|
||||
=======
|
||||
string BoundedBuffer::pop(){
|
||||
full->P();
|
||||
mutex->P();
|
||||
string item = data.back();
|
||||
data.pop_back();
|
||||
mutex->V();
|
||||
empty->V();
|
||||
return item;
|
||||
>>>>>>> 05aaecdb17812b161db2168b80a19fc2c783800b
|
||||
return item;
|
||||
}
|
||||
|
|
@ -24,11 +24,7 @@ public:
|
|||
|
||||
BoundedBuffer(int b){
|
||||
empty = new Semaphore(b);
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
void set_empty(int e){empty = new Semaphore(e);}
|
||||
=======
|
||||
}
|
||||
void set_empty(int e){
|
||||
delete empty;
|
||||
empty = new Semaphore(e);
|
||||
|
@ -36,8 +32,7 @@ public:
|
|||
|
||||
bool is_empty() {
|
||||
return (data.size() == 0);
|
||||
}
|
||||
>>>>>>> 05aaecdb17812b161db2168b80a19fc2c783800b
|
||||
}
|
||||
|
||||
void push(string item);
|
||||
|
||||
|
|
Reference in a new issue