1 /* Copyright (c) 2010-2018. The SimGrid Team. All rights reserved. */
3 /* This program is free software; you can redistribute it and/or modify it
4 * under the terms of the license (GNU LGPL) which comes with this package. */
6 #include "simgrid/s4u.hpp"
9 XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_test, "Messages specific for this s4u example");
13 simgrid::s4u::Host* jupiter = simgrid::s4u::Host::by_name("Jupiter");
14 XBT_INFO("Master waiting");
15 simgrid::s4u::this_actor::sleep_for(1);
17 XBT_INFO("Turning off the worker host");
19 XBT_INFO("Master has finished");
24 XBT_INFO("Worker waiting");
26 simgrid::s4u::this_actor::sleep_for(5);
28 if (e.category == host_error) {
29 XBT_INFO("The host has died ... as expected.");
31 XBT_ERROR("An unexpected exception has been raised.");
37 int main(int argc, char* argv[])
39 simgrid::s4u::Engine e(&argc, argv);
40 e.load_platform(argv[1]);
42 simgrid::s4u::Actor::create("master", simgrid::s4u::Host::by_name("Tremblay"), master);
43 simgrid::s4u::Actor::create("worker", simgrid::s4u::Host::by_name("Jupiter"), worker);
46 XBT_INFO("Simulation time %g", e.get_clock());