This repository has been archived on 2025-04-11. You can view files and clone it, but cannot push or open issues or pull requests.
csce313-mp4pinie64backup/BoundedBuffer.cpp
shadow8t4 713415f153 s
2015-11-09 17:18:35 -06:00

21 lines
No EOL
375 B
C++
Executable file

#include "semaphore.h"
#include "BoundedBuffer.h"
#include <string>
#include <vector>
void BoundedBuffer::push(string item){
empty->P();
data.push_back(item);
full->V();//increment the number of full slots now.
}
string BoundedBuffer::pop(){
string item = data.back();
full->P();
data.pop_back();
empty->V();
return item;
}