X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/e94c2a7fc81a82998524aa55db075be69990d4ea..7749be177cbd7d433ec389a155efff301969c6ee:/examples/s4u/async-ready/s4u-async-ready.cpp diff --git a/examples/s4u/async-ready/s4u-async-ready.cpp b/examples/s4u/async-ready/s4u-async-ready.cpp index c23158b1ee..ca868e2604 100644 --- a/examples/s4u/async-ready/s4u-async-ready.cpp +++ b/examples/s4u/async-ready/s4u-async-ready.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2010-2018. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2010-2019. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -23,7 +23,7 @@ #include #include -XBT_LOG_NEW_DEFAULT_CATEGORY(msg_async_ready, "Messages specific for this s4u example"); +XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_async_ready, "Messages specific for this s4u example"); static int peer(int argc, char** argv) { @@ -34,7 +34,7 @@ static int peer(int argc, char** argv) long peers_count = std::stod(argv[4]); /* - number of peers */ /* Set myself as the persistent receiver of my mailbox so that messages start flowing to me as soon as they are put into it */ - simgrid::s4u::MailboxPtr my_mbox = simgrid::s4u::Mailbox::by_name(std::string("peer-") + std::to_string(my_id)); + simgrid::s4u::Mailbox* my_mbox = simgrid::s4u::Mailbox::by_name(std::string("peer-") + std::to_string(my_id)); my_mbox->set_receiver(simgrid::s4u::Actor::self()); std::vector pending_comms; @@ -44,7 +44,7 @@ static int peer(int argc, char** argv) for (int peer_id = 0; peer_id < peers_count; peer_id++) { if (peer_id != my_id) { std::string mboxName = std::string("peer-") + std::to_string(peer_id); - simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::by_name(mboxName); + simgrid::s4u::Mailbox* mbox = simgrid::s4u::Mailbox::by_name(mboxName); std::string msgName = std::string("Message ") + std::to_string(i) + std::string(" from peer ") + std::to_string(my_id); std::string* payload = new std::string(msgName); // copy the data we send: // 'msgName' is not a stable storage location @@ -59,7 +59,7 @@ static int peer(int argc, char** argv) for (int peer_id = 0; peer_id < peers_count; peer_id++) { if (peer_id != my_id) { std::string mboxName = std::string("peer-") + std::to_string(peer_id); - simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::by_name(mboxName); + simgrid::s4u::Mailbox* mbox = simgrid::s4u::Mailbox::by_name(mboxName); std::string* payload = new std::string("finalize"); // Make a copy of the data we will send pending_comms.push_back(mbox->put_async(payload, msg_size)); XBT_INFO("Send 'finalize' to 'peer-%d'", peer_id); @@ -72,7 +72,7 @@ static int peer(int argc, char** argv) while (pending_finalize_messages > 0) { if (my_mbox->ready()) { double start = simgrid::s4u::Engine::get_clock(); - std::string* received = static_cast(my_mbox->get()); + const std::string* received = static_cast(my_mbox->get()); double waiting_time = simgrid::s4u::Engine::get_clock() - start; xbt_assert(waiting_time == 0, "Expecting the waiting time to be 0 because the communication was supposedly ready, but got %f instead", waiting_time); XBT_INFO("I got a '%s'.", received->c_str());