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