24 lines
473 B
C++
Executable file
24 lines
473 B
C++
Executable file
|
|
|
|
class BoundedBuffer{
|
|
Semaphore full(0); //initialized to 0, Since there are 0 full slots
|
|
Semaphore empty(b); //initialized to b, Since all the slots are empty
|
|
Semaphore mutex(0);
|
|
|
|
int b;
|
|
|
|
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
|
|
}
|
|
|