s
This commit is contained in:
parent
555bdc7e41
commit
713415f153
4 changed files with 8 additions and 6 deletions
|
@ -19,4 +19,3 @@ string BoundedBuffer::pop(){
|
||||||
empty->V();
|
empty->V();
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,8 @@ public:
|
||||||
|
|
||||||
void set_b(int b){ b_val = b;}
|
void set_b(int b){ b_val = b;}
|
||||||
|
|
||||||
|
int get_val(){ return b_val; }
|
||||||
|
|
||||||
void push(string item);
|
void push(string item);
|
||||||
|
|
||||||
string pop();
|
string pop();
|
||||||
|
|
|
@ -158,6 +158,7 @@ void handle_process_loop(RequestChannel & _channel) {
|
||||||
cout << "New request is " << request << endl;
|
cout << "New request is " << request << endl;
|
||||||
|
|
||||||
if (request.compare("quit") == 0) {
|
if (request.compare("quit") == 0) {
|
||||||
|
cout << "\nquit\n";
|
||||||
_channel.cwrite("bye");
|
_channel.cwrite("bye");
|
||||||
usleep(10000); // give the other end a bit of time.
|
usleep(10000); // give the other end a bit of time.
|
||||||
break; // break out of the loop;
|
break; // break out of the loop;
|
||||||
|
|
|
@ -109,8 +109,8 @@ int main(int argc, char * argv[]) {
|
||||||
|
|
||||||
string channel_name;
|
string channel_name;
|
||||||
for(int i=0; i < w; i++){
|
for(int i=0; i < w; i++){
|
||||||
channel_name = chan.send_request("newthread");
|
channel_name = chan.send_request("newthrread");
|
||||||
cout << "Chan: " << channel_name << endl;
|
cout << "\nChan: " << channel_name << endl;
|
||||||
RequestChannel* worker_ret = new RequestChannel(channel_name, RequestChannel::CLIENT_SIDE);
|
RequestChannel* worker_ret = new RequestChannel(channel_name, RequestChannel::CLIENT_SIDE);
|
||||||
Worker_Thread(argv, worker_ret);
|
Worker_Thread(argv, worker_ret);
|
||||||
}
|
}
|
||||||
|
@ -135,7 +135,7 @@ void* Worker_Thread(char* arg[], RequestChannel* chan){
|
||||||
//control chan("control", RequestChannel::CLIENT_SIDE);
|
//control chan("control", RequestChannel::CLIENT_SIDE);
|
||||||
//string channel_name = control.send_request("newthread");
|
//string channel_name = control.send_request("newthread");
|
||||||
//RequestChannel * channel_ret = new RequestChannel(channel_name, RequestChannel::CLIENT_SIDE);
|
//RequestChannel * channel_ret = new RequestChannel(channel_name, RequestChannel::CLIENT_SIDE);
|
||||||
while(true){
|
while(Request_Buffer->get_val() != 0){
|
||||||
|
|
||||||
|
|
||||||
string req = Request_Buffer->pop();
|
string req = Request_Buffer->pop();
|
||||||
|
|
Reference in a new issue