1 /* Copyright (c) 2017. The SimGrid Team.
2 * All rights reserved. */
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. */
7 #include "simgrid/s4u.hpp"
9 XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_test, "Messages specific for this s4u example");
13 XBT_INFO("Sleeper started");
14 simgrid::s4u::this_actor::sleep_for(3);
15 XBT_INFO("I'm done. See you!");
20 simgrid::s4u::ActorPtr actor;
22 XBT_INFO("Start sleeper");
23 actor = simgrid::s4u::Actor::createActor("sleeper from master", simgrid::s4u::Host::current(), sleeper);
24 XBT_INFO("Join the sleeper (timeout 2)");
27 XBT_INFO("Start sleeper");
28 actor = simgrid::s4u::Actor::createActor("sleeper from master", simgrid::s4u::Host::current(), sleeper);
29 XBT_INFO("Join the sleeper (timeout 4)");
32 XBT_INFO("Start sleeper");
33 actor = simgrid::s4u::Actor::createActor("sleeper from master", simgrid::s4u::Host::current(), sleeper);
34 XBT_INFO("Join the sleeper (timeout 2)");
37 XBT_INFO("Start sleeper");
38 actor = simgrid::s4u::Actor::createActor("sleeper from master", simgrid::s4u::Host::current(), sleeper);
39 XBT_INFO("Waiting 4");
40 simgrid::s4u::this_actor::sleep_for(4);
41 XBT_INFO("Join the sleeper after its end (timeout 1)");
44 XBT_INFO("Goodbye now!");
46 simgrid::s4u::this_actor::sleep_for(1);
48 XBT_INFO("Goodbye now!");
51 int main(int argc, char* argv[])
53 simgrid::s4u::Engine e(&argc, argv);
54 xbt_assert(argc == 2, "Usage: %s platform_file\n\tExample: %s msg_platform.xml\n", argv[0], argv[0]);
56 e.loadPlatform(argv[1]);
58 simgrid::s4u::Actor::createActor("master", simgrid::s4u::Host::by_name("Tremblay"), master);
62 XBT_INFO("Simulation time %g", simgrid::s4u::Engine::getClock());