Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
delete the process at the end of the main method
[simgrid.git] / examples / cxx / basic / Master.cxx
index f6e06d207fb7030ea17b18cd585a8a3594b8ec2a..cec35f140f76578ce5f7d1fea24d807c027b4e79 100644 (file)
@@ -4,6 +4,8 @@
 #include <Host.hpp>\r
 #include <HostNotFoundException.hpp>\r
 \r
+#include <Msg.hpp>\r
+\r
 #include <iostream>\r
 using namespace std;\r
 \r
@@ -82,8 +84,8 @@ int Master::main(int argc, char** argv)
                cout <<"[" << getName() << ":" << getHost().getName() << "] " << "Sending \"" << todo[i]->getName() << "\" to \"" << slaves[i % slaveCount].getName() << "\"" << endl;\r
        \r
                if(!strcmp(Host::currentHost().getName(), slaves[i % slaveCount].getName())) \r
-                       cout <<"[" << getName() << ":" << getHost().getName() << "] " << "Hey ! It's me ! ";\r
-       \r
+                       cout <<"[" <<  getName() << ":" << getHost().getName() << "] " << "Hey ! It's me ! ";\r
+\r
                slaves[i % slaveCount].put(channel, todo[i]);\r
        }\r
        \r
@@ -92,19 +94,14 @@ int Master::main(int argc, char** argv)
        cout <<"[" << getName() << ":" << getHost().getName() << "] " << "All tasks have been dispatched. Let's tell everybody the computation is over." << endl;\r
        \r
        for (int i = 0; i < slaveCount; i++) \r
-       {\r
-               slaves[i].put(channel, new FinalizeTask());\r
-       }\r
-       \r
-\r
-       for(int i = 0; i < numberOfTasks; i++)\r
-               delete todo[i];\r
+                       slaves[i].put(channel, new FinalizeTask());\r
 \r
        delete[] todo;\r
-\r
        delete[] slaves;\r
        \r
        cout <<"[" << getName() << ":" << getHost().getName() << "] " << "Goodbye now!" << endl;\r
 \r
+       delete this;\r
+\r
        return 0;\r
 }
\ No newline at end of file