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.h
Eric Buxkemper 9e67f43b8e V5
2015-11-06 12:53:10 -06:00

28 lines
595 B
C++
Executable file

#include <vector>
using namespace std;
unsigned int n = 20, b = 100, w = 5;
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<string> data;
//BoundedBuffer(
void set_b(int val_b){ b = val_b;}
void push(string item);
void pop();
//can't be larger than b strings
//b = user input
};