| 45 | } |
| 46 | |
| 47 | void MyProcess::Execute() |
| 48 | { |
| 49 | // multiprocess logic |
| 50 | int numProcs = this->Controller->GetNumberOfProcesses(); |
| 51 | int me = this->Controller->GetLocalProcessId(); |
| 52 | |
| 53 | std::cout << "numProcs=" << numProcs << " me=" << me << std::endl; |
| 54 | std::cout << "executable=" << this->Argv[0] << std::endl; |
| 55 | std::cout << "argc=" << this->Argc << std::endl; |
| 56 | |
| 57 | const int MY_RETURN_VALUE_MESSAGE = 0x11; |
| 58 | |
| 59 | if (me == 0) |
| 60 | { |
| 61 | // root node |
| 62 | this->ReturnValue = 0; |
| 63 | int i = 1; |
| 64 | while (i < numProcs) |
| 65 | { |
| 66 | this->Controller->Send(&this->ReturnValue, 1, i, MY_RETURN_VALUE_MESSAGE); |
| 67 | ++i; |
| 68 | } |
| 69 | } |
| 70 | else |
| 71 | { |
| 72 | // satellites |
| 73 | this->Controller->Receive(&this->ReturnValue, 1, 0, MY_RETURN_VALUE_MESSAGE); |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | } |
| 78 |
no test coverage detected