1 /* Copyright (c) 2017-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"
8 XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_test, "Messages specific for this s4u example");
12 XBT_INFO("Sleeper started");
13 simgrid::s4u::this_actor::sleep_for(3);
14 XBT_INFO("I'm done. See you!");
19 simgrid::s4u::ActorPtr actor;
21 XBT_INFO("Start sleeper");
22 actor = simgrid::s4u::Actor::create("sleeper from master", simgrid::s4u::Host::current(), sleeper);
23 XBT_INFO("Join the sleeper (timeout 2)");
26 XBT_INFO("Start sleeper");
27 actor = simgrid::s4u::Actor::create("sleeper from master", simgrid::s4u::Host::current(), sleeper);
28 XBT_INFO("Join the sleeper (timeout 4)");
31 XBT_INFO("Start sleeper");
32 actor = simgrid::s4u::Actor::create("sleeper from master", simgrid::s4u::Host::current(), sleeper);
33 XBT_INFO("Join the sleeper (timeout 2)");
36 XBT_INFO("Start sleeper");
37 actor = simgrid::s4u::Actor::create("sleeper from master", simgrid::s4u::Host::current(), sleeper);
38 XBT_INFO("Waiting 4");
39 simgrid::s4u::this_actor::sleep_for(4);
40 XBT_INFO("Join the sleeper after its end (timeout 1)");
43 XBT_INFO("Goodbye now!");
45 simgrid::s4u::this_actor::sleep_for(1);
47 XBT_INFO("Goodbye now!");
50 int main(int argc, char* argv[])
52 simgrid::s4u::Engine e(&argc, argv);
53 xbt_assert(argc == 2, "Usage: %s platform_file\n\tExample: %s msg_platform.xml\n", argv[0], argv[0]);
55 e.load_platform(argv[1]);
57 simgrid::s4u::Actor::create("master", simgrid::s4u::Host::by_name("Tremblay"), master);
61 XBT_INFO("Simulation time %g", simgrid::s4u::Engine::get_clock());