From 4545d514a2f24514239244c8699a4d4a7d014dff Mon Sep 17 00:00:00 2001 From: shadow8t4 Date: Tue, 10 Nov 2015 15:49:32 -0600 Subject: [PATCH] t --- BoundedBuffer.h | 2 -- simpleclient.cpp | 13 +++++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/BoundedBuffer.h b/BoundedBuffer.h index a34afa4..6ba44a9 100755 --- a/BoundedBuffer.h +++ b/BoundedBuffer.h @@ -33,8 +33,6 @@ public: int get_val(){return b_val;} void set_b(int b){ b_val = b;} - - int get_val(){ return b_val; } void push(string item); diff --git a/simpleclient.cpp b/simpleclient.cpp index b71f4e8..97e558b 100755 --- a/simpleclient.cpp +++ b/simpleclient.cpp @@ -109,12 +109,17 @@ int main(int argc, char * argv[]) { string channel_name; for(int i=0; i < w; i++){ - channel_name = chan.send_request("newthrread"); + channel_name = chan.send_request("newthread"); cout << "\nChan: " << channel_name << endl; RequestChannel* worker_ret = new RequestChannel(channel_name, RequestChannel::CLIENT_SIDE); - Worker_Thread(argv, worker_ret); + pid = fork(); + if(pid != 0) { + Worker_Thread(argv, worker_ret); + break; + } } - + + chan.send_request("quit"); } @@ -130,7 +135,7 @@ void* Worker_Thread(char* arg[], RequestChannel* chan){ //control chan("control", RequestChannel::CLIENT_SIDE); //string channel_name = control.send_request("newthread"); //RequestChannel * channel_ret = new RequestChannel(channel_name, RequestChannel::CLIENT_SIDE); - while(Request_Buffer->get_val() != 0){ + while(true){ string req = Request_Buffer->pop(); cout << "Request: " << req << endl;