21 lines
No EOL
375 B
C++
Executable file
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;
|
|
} |