auto c34 = sg4::Comm::sendto_init(h3, h4); // Creates but do not start another direct communication
c34->set_remaining(1e7); // Specify the amount of bytes to exchange in this comm
+ // You can also detach() communications that you never plan to test() or wait().
+ // Here we create a communication that only slows down the other ones
+ auto noise = sg4::Comm::sendto_init(h1, h2);
+ noise->set_remaining(10000);
+ noise->detach();
+
XBT_INFO("After creation, c12 is %s (remaining: %.2e bytes); c34 is %s (remaining: %.2e bytes)",
c12->get_state_str(), c12->get_remaining(), c34->get_state_str(), c34->get_remaining());
sg4::this_actor::sleep_for(1);
XBT_INFO("After c34->wait, c12 is %s (remaining: %.2e bytes); c34 is %s (remaining: %.2e bytes)",
c12->get_state_str(), c12->get_remaining(), c34->get_state_str(), c34->get_remaining());
- /* As usual, you don't have to explicitly start communications that were just init()ed. The wait() will start it
- * automatically. */
+ /* As usual, you don't have to explicitly start communications that were just init()ed.
+ The wait() will start it automatically. */
auto c14 = sg4::Comm::sendto_init(h1, h4);
c14->set_remaining(100)->wait(); // Chaining 2 operations on this new communication
}
sg4::Engine e(&argc, argv);
e.load_platform(argv[1]);
- sg4::Actor::create("sender", sg4::Host::by_name("Tremblay"), sender, sg4::Host::by_name("Tremblay"),
+ sg4::Actor::create("sender", sg4::Host::by_name("Boivin"), sender, sg4::Host::by_name("Tremblay"),
sg4::Host::by_name("Jupiter"), sg4::Host::by_name("Fafard"), sg4::Host::by_name("Ginette"));
e.run();