-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathslave.cpp
More file actions
47 lines (38 loc) · 1.05 KB
/
slave.cpp
File metadata and controls
47 lines (38 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
* File: slave.cpp
* Author: alex
*
* Created on 21 gennaio 2013, 12.35
*/
#include "slave.h"
using namespace std;
slave::slave() {
}
slave::slave(const slave& orig) {
}
slave::~slave() {
}
void slave::mainSlave(int argc,char **argv, long id, long p){
bool end=true;
bool status;
while (end == true){
tache *t = new tache;
//cout << "SLAVE" << id << ": Waiting to receive another task"<< id << "\n";
end = t->receiveTache(0,false,id);
if (end==false){
break;
}
//cout << "SLAVE" << id << ": Starting running tache " << t->name << "\n";
status = t->run(id);
if (status == false){
cout << "SLAVE" << id << ": Houston, we have a problem\n";
// cout << "SLAVE" << id << ": ID of the slave" << id <"\n";
// cout << "SLAVE" << id << ": The TACHE " << t->name <"\n";
}
t->sendTache(0,true);
delete t;
//end=true;
}
cout << "SLAVE" << id << ": I'm exiting"<< id << "\n";
return;
}