Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Examples of CPP versions of Msg
[simgrid.git] / examples / cxx / suspend / LazyGuy.cxx
1 #include "LazyGuy.hpp"\r
2 #include <Host.hpp>\r
3 \r
4 #include <iostream>\r
5 using namespace std;\r
6 \r
7 MSG_IMPLEMENT_DYNAMIC(LazyGuy, Process);\r
8 \r
9 int LazyGuy::main(int argc, char** argv)\r
10 {\r
11         cout <<"[" << getName() << ":" << getHost().getName() << "] " << "Hello !" << endl;\r
12         \r
13         cout <<"[" << getName() << ":" << getHost().getName() << "] " << "Nobody's watching me ? Let's go to sleep." << endl;\r
14         \r
15         Process::currentProcess().suspend();\r
16         \r
17         cout <<"[" << getName() << ":" << getHost().getName() << "] " << "Uuuh ? Did somebody call me ?" << endl;\r
18         cout <<"[" << getName() << ":" << getHost().getName() << "] " << "Mmmh, goodbye now." << endl; \r
19 \r
20 \r
21         delete this;\r
22 \r
23         return 0;\r
24 }