This commit is contained in:
shadow8t4 2015-11-10 15:49:32 -06:00
parent f4109d605f
commit 4545d514a2
2 changed files with 9 additions and 6 deletions

View file

@ -34,8 +34,6 @@ 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();

View file

@ -109,12 +109,17 @@ 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("newthrread"); channel_name = chan.send_request("newthread");
cout << "\nChan: " << 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); pid = fork();
if(pid != 0) {
Worker_Thread(argv, worker_ret);
break;
}
} }
chan.send_request("quit"); chan.send_request("quit");
} }
@ -130,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(Request_Buffer->get_val() != 0){ while(true){
string req = Request_Buffer->pop(); string req = Request_Buffer->pop();
cout << "Request: " << req << endl; cout << "Request: " << req << endl;