Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
62ed58f119d810cdbcfa3bd540efd796268f3897
[simgrid.git] / examples / cxx / suspend / DreamMaster.cxx
1 #include "DreamMaster.hpp"\r
2 #include "LazyGuy.hpp"\r
3 #include <Host.hpp>\r
4 #include <HostNotFoundException.hpp>\r
5 #include <Msg.hpp>\r
6 \r
7 #include <Msg.hpp>\r
8 \r
9 \r
10 MSG_IMPLEMENT_DYNAMIC(DreamMaster, Process);\r
11 \r
12 int DreamMaster::main(int argc, char** argv)\r
13 {\r
14         \r
15         info("Hello");\r
16         \r
17         info("Let's create a lazy guy.");\r
18         \r
19 \r
20         LazyGuy* lazy;\r
21 \r
22         try\r
23         {\r
24                 Host currentHost = Host::currentHost();\r
25         \r
26                 info(TEXT_("Current host  name : ") + TEXT_(currentHost.getName()));\r
27         \r
28                 lazy = new LazyGuy(currentHost,"LazyGuy");\r
29         \r
30                 info("Let's wait a little bit...");\r
31         \r
32                 Process::sleep(10.0);\r
33         \r
34                 info("Let's wake the lazy guy up! >:) ");\r
35         \r
36                 lazy->resume();\r
37         \r
38         \r
39         }\r
40         catch(HostNotFoundException e)\r
41         {\r
42                 error(TEXT_(e.toString()) + TEXT_(". Stopping Now!"));\r
43                 exit(1);\r
44         }\r
45         \r
46         //lazy->migrate(currentHost);\r
47         \r
48         info("OK, goodbye now.");\r
49 \r
50         delete this;\r
51 \r
52         return 0;\r
53         \r
54 }