Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
hide a (grave) warning in the tests
[simgrid.git] / teshsuite / s4u / host_on_off_wait / host_on_off_wait.cpp
1 /* Copyright (c) 2010-2015. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. */
6
7 #include "simgrid/s4u.hpp"
8
9 XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_test, "Messages specific for this s4u example");
10
11 static void master()
12 {
13   simgrid::s4u::Host* jupiter = simgrid::s4u::Host::by_name("Jupiter");
14   XBT_INFO("Master waiting");
15   simgrid::s4u::this_actor::sleep_for(1);
16
17   XBT_INFO("Turning off the worker host");
18   jupiter->turnOff();
19   XBT_INFO("Master has finished");
20 }
21
22 static void worker()
23 {
24   XBT_INFO("Worker waiting");
25   // TODO, This should really be MSG_HOST_FAILURE
26   simgrid::s4u::this_actor::sleep_for(5);
27   XBT_ERROR("Worker should be off already.");
28 }
29
30 int main(int argc, char* argv[])
31 {
32   simgrid::s4u::Engine* e = new simgrid::s4u::Engine(&argc, argv);
33   e->loadPlatform(argv[1]);
34
35   simgrid::s4u::Actor::createActor("master", simgrid::s4u::Host::by_name("Tremblay"), master);
36   simgrid::s4u::Actor::createActor("worker", simgrid::s4u::Host::by_name("Jupiter"), worker);
37
38   e->run();
39   XBT_INFO("Simulation time %g", e->getClock());
40   return 0;
41 }