From aa67057cbae409c22a57e9dcf4d82a2859e97f45 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Tue, 15 May 2018 22:46:29 +0200 Subject: [PATCH] snake_case s4u::Mailbox --- .../s4u/actor-create/s4u-actor-create.cpp | 8 ++-- examples/s4u/app-bittorrent/s4u-peer.cpp | 6 +-- examples/s4u/app-bittorrent/s4u-peer.hpp | 2 +- examples/s4u/app-bittorrent/s4u-tracker.cpp | 2 +- .../s4u/app-chainsend/s4u-app-chainsend.cpp | 4 +- .../app-masterworker/s4u-app-masterworker.cpp | 6 +-- .../s4u/app-pingpong/s4u-app-pingpong.cpp | 8 ++-- .../s4u/app-token-ring/s4u-app-token-ring.cpp | 6 +-- examples/s4u/async-wait/s4u-async-wait.cpp | 6 +-- .../s4u/async-waitall/s4u-async-waitall.cpp | 6 +-- .../s4u/async-waitany/s4u-async-waitany.cpp | 6 +-- .../s4u/cloud-simple/s4u-cloud-simple.cpp | 4 +- examples/s4u/dht-chord/s4u-dht-chord-node.cpp | 22 +++++----- examples/s4u/dht-kademlia/node.cpp | 10 ++--- .../s4u/dht-kademlia/s4u-dht-kademlia.cpp | 2 +- examples/s4u/energy-link/s4u-energy-link.cpp | 4 +- examples/s4u/replay-comm/s4u-replay-comm.cpp | 5 ++- include/simgrid/s4u/Mailbox.hpp | 42 ++++++++++++------- src/msg/msg_gos.cpp | 12 +++--- src/msg/msg_mailbox.cpp | 2 +- src/plugins/vm/VmLiveMigration.cpp | 2 +- src/plugins/vm/VmLiveMigration.hpp | 12 +++--- src/s4u/s4u_Mailbox.cpp | 10 ++--- src/smpi/internals/smpi_process.cpp | 6 +-- teshsuite/s4u/comm-pt2pt/comm-pt2pt.cpp | 12 +++--- teshsuite/s4u/listen_async/listen_async.cpp | 6 +-- teshsuite/s4u/pid/pid.cpp | 4 +- .../storage_client_server.cpp | 6 +-- 28 files changed, 118 insertions(+), 103 deletions(-) diff --git a/examples/s4u/actor-create/s4u-actor-create.cpp b/examples/s4u/actor-create/s4u-actor-create.cpp index 6f18c3ad4a..0e2c87df55 100644 --- a/examples/s4u/actor-create/s4u-actor-create.cpp +++ b/examples/s4u/actor-create/s4u-actor-create.cpp @@ -29,7 +29,7 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_actor_create, "The logging channel used in this */ static void receiver(std::string mailbox_name) { - simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName(mailbox_name); + simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name(mailbox_name); XBT_INFO("Hello s4u, I'm ready to get any message you'd want on %s", mailbox->get_cname()); @@ -47,8 +47,8 @@ static void receiver(std::string mailbox_name) static int forwarder(int argc, char** argv) { xbt_assert(argc >= 3, "Actor forwarder requires 2 parameters, but got only %d", argc - 1); - simgrid::s4u::MailboxPtr in = simgrid::s4u::Mailbox::byName(argv[1]); - simgrid::s4u::MailboxPtr out = simgrid::s4u::Mailbox::byName(argv[2]); + simgrid::s4u::MailboxPtr in = simgrid::s4u::Mailbox::by_name(argv[1]); + simgrid::s4u::MailboxPtr out = simgrid::s4u::Mailbox::by_name(argv[2]); std::string* msg = static_cast(in->get()); XBT_INFO("Forward '%s'.", msg->c_str()); out->put(msg, msg->size()); @@ -79,7 +79,7 @@ public: void operator()() /* This is the main code of the actor */ { XBT_INFO("Hello s4u, I have something to send"); - simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName(mbox); + simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name(mbox); mailbox->put(new std::string(msg), msg.size()); XBT_INFO("I'm done. See you."); diff --git a/examples/s4u/app-bittorrent/s4u-peer.cpp b/examples/s4u/app-bittorrent/s4u-peer.cpp index 7affb48f92..21fefba662 100644 --- a/examples/s4u/app-bittorrent/s4u-peer.cpp +++ b/examples/s4u/app-bittorrent/s4u-peer.cpp @@ -33,7 +33,7 @@ Peer::Peer(std::vector args) xbt_assert(args.size() == 3 || args.size() == 4, "Wrong number of arguments"); try { id = std::stoi(args[1]); - mailbox_ = simgrid::s4u::Mailbox::byName(std::to_string(id)); + mailbox_ = simgrid::s4u::Mailbox::by_name(std::to_string(id)); } catch (std::invalid_argument& ia) { throw std::invalid_argument(std::string("Invalid ID:") + args[1].c_str()); } @@ -70,7 +70,7 @@ void Peer::operator()() if (getPeersFromTracker()) { XBT_DEBUG("Got %zu peers from the tracker. Current status is: %s", connected_peers.size(), getStatus().c_str()); begin_receive_time = simgrid::s4u::Engine::get_clock(); - mailbox_->setReceiver(simgrid::s4u::Actor::self()); + mailbox_->set_receiver(simgrid::s4u::Actor::self()); if (hasFinished()) { sendHandshakeToAllPeers(); } else { @@ -86,7 +86,7 @@ void Peer::operator()() bool Peer::getPeersFromTracker() { - simgrid::s4u::MailboxPtr tracker_mailbox = simgrid::s4u::Mailbox::byName(TRACKER_MAILBOX); + simgrid::s4u::MailboxPtr tracker_mailbox = simgrid::s4u::Mailbox::by_name(TRACKER_MAILBOX); // Build the task to send to the tracker TrackerQuery* peer_request = new TrackerQuery(id, mailbox_); try { diff --git a/examples/s4u/app-bittorrent/s4u-peer.hpp b/examples/s4u/app-bittorrent/s4u-peer.hpp index 1f4fe9ad77..c099e9c2e2 100644 --- a/examples/s4u/app-bittorrent/s4u-peer.hpp +++ b/examples/s4u/app-bittorrent/s4u-peer.hpp @@ -24,7 +24,7 @@ public: bool choked_upload = true; // Indicates if the peer is choked for the current peer bool choked_download = true; // Indicates if the peer has choked the current peer - explicit Connection(int id) : id(id), mailbox_(simgrid::s4u::Mailbox::byName(std::to_string(id))){}; + explicit Connection(int id) : id(id), mailbox_(simgrid::s4u::Mailbox::by_name(std::to_string(id))){}; ~Connection() = default; void addSpeedValue(double speed) { peer_speed = peer_speed * 0.6 + speed * 0.4; } bool hasPiece(unsigned int piece) { return bitfield & 1U << piece; } diff --git a/examples/s4u/app-bittorrent/s4u-tracker.cpp b/examples/s4u/app-bittorrent/s4u-tracker.cpp index 0c146226a3..90dac0a72b 100644 --- a/examples/s4u/app-bittorrent/s4u-tracker.cpp +++ b/examples/s4u/app-bittorrent/s4u-tracker.cpp @@ -24,7 +24,7 @@ Tracker::Tracker(std::vector args) stream = simgrid::s4u::this_actor::get_host()->extension()->getStream(); - mailbox = simgrid::s4u::Mailbox::byName(TRACKER_MAILBOX); + mailbox = simgrid::s4u::Mailbox::by_name(TRACKER_MAILBOX); XBT_INFO("Tracker launched."); } diff --git a/examples/s4u/app-chainsend/s4u-app-chainsend.cpp b/examples/s4u/app-chainsend/s4u-app-chainsend.cpp index d4d3d72ede..79785f5122 100644 --- a/examples/s4u/app-chainsend/s4u-app-chainsend.cpp +++ b/examples/s4u/app-chainsend/s4u-app-chainsend.cpp @@ -42,7 +42,7 @@ public: unsigned int received_pieces = 0; unsigned int total_pieces = 0; - Peer() { me = simgrid::s4u::Mailbox::byName(simgrid::s4u::Host::current()->get_cname()); } + Peer() { me = simgrid::s4u::Mailbox::by_name(simgrid::s4u::Host::current()->get_cname()); } ~Peer() = default; void joinChain() @@ -146,7 +146,7 @@ public: for (int i = 1; i <= hostcount; i++) { std::string name = std::string("node-") + std::to_string(i) + ".acme.org"; XBT_DEBUG("%s", name.c_str()); - mailboxes.push_back(simgrid::s4u::Mailbox::byName(name)); + mailboxes.push_back(simgrid::s4u::Mailbox::by_name(name)); } } diff --git a/examples/s4u/app-masterworker/s4u-app-masterworker.cpp b/examples/s4u/app-masterworker/s4u-app-masterworker.cpp index e35991f737..852b18a6ce 100644 --- a/examples/s4u/app-masterworker/s4u-app-masterworker.cpp +++ b/examples/s4u/app-masterworker/s4u-app-masterworker.cpp @@ -33,7 +33,7 @@ public: { for (int i = 0; i < number_of_tasks; i++) { /* For each task to be executed: */ /* - Select a @ref worker in a round-robin way */ - mailbox = simgrid::s4u::Mailbox::byName(std::string("worker-") + std::to_string(i % workers_count)); + mailbox = simgrid::s4u::Mailbox::by_name(std::string("worker-") + std::to_string(i % workers_count)); if (number_of_tasks < 10000 || i % 10000 == 0) XBT_INFO("Sending \"%s\" (of %ld) to mailbox \"%s\"", (std::string("Task_") + std::to_string(i)).c_str(), @@ -46,7 +46,7 @@ public: XBT_INFO("All tasks have been dispatched. Let's tell everybody the computation is over."); for (int i = 0; i < workers_count; i++) { /* - Eventually tell all the workers to stop by sending a "finalize" task */ - mailbox = simgrid::s4u::Mailbox::byName(std::string("worker-") + std::to_string(i % workers_count)); + mailbox = simgrid::s4u::Mailbox::by_name(std::string("worker-") + std::to_string(i % workers_count)); mailbox->put(new double(-1.0), 0); } } @@ -62,7 +62,7 @@ public: xbt_assert(args.size() == 2, "The worker expects a single argument from the XML deployment file: " "its worker ID (its numerical rank)"); id = std::stol(args[1]); - mailbox = simgrid::s4u::Mailbox::byName(std::string("worker-") + std::to_string(id)); + mailbox = simgrid::s4u::Mailbox::by_name(std::string("worker-") + std::to_string(id)); } void operator()() diff --git a/examples/s4u/app-pingpong/s4u-app-pingpong.cpp b/examples/s4u/app-pingpong/s4u-app-pingpong.cpp index 542b1b4175..3d7d79e99b 100644 --- a/examples/s4u/app-pingpong/s4u-app-pingpong.cpp +++ b/examples/s4u/app-pingpong/s4u-app-pingpong.cpp @@ -18,10 +18,10 @@ static void pinger(std::vector args) double* payload = new double(); *payload = simgrid::s4u::Engine::get_clock(); - simgrid::s4u::Mailbox::byName(args[0])->put(payload, 1); + simgrid::s4u::Mailbox::by_name(args[0])->put(payload, 1); /* - ... then wait for the (large) pong */ double* sender_time = - static_cast(simgrid::s4u::Mailbox::byName(simgrid::s4u::this_actor::get_host()->get_name())->get()); + static_cast(simgrid::s4u::Mailbox::by_name(simgrid::s4u::this_actor::get_host()->get_name())->get()); double communication_time = simgrid::s4u::Engine::get_clock() - *sender_time; XBT_INFO("Task received : large communication (bandwidth bound)"); @@ -38,7 +38,7 @@ static void ponger(std::vector args) /* - Receive the (small) ping first ....*/ double* sender_time = - static_cast(simgrid::s4u::Mailbox::byName(simgrid::s4u::this_actor::get_host()->get_name())->get()); + static_cast(simgrid::s4u::Mailbox::by_name(simgrid::s4u::this_actor::get_host()->get_name())->get()); double communication_time = simgrid::s4u::Engine::get_clock() - *sender_time; XBT_INFO("Task received : small communication (latency bound)"); XBT_INFO(" Ping time (latency bound) %f", communication_time); @@ -49,7 +49,7 @@ static void ponger(std::vector args) *payload = simgrid::s4u::Engine::get_clock(); XBT_INFO("task_bw->data = %.3f", *payload); - simgrid::s4u::Mailbox::byName(args[0])->put(payload, 1e9); + simgrid::s4u::Mailbox::by_name(args[0])->put(payload, 1e9); } int main(int argc, char* argv[]) diff --git a/examples/s4u/app-token-ring/s4u-app-token-ring.cpp b/examples/s4u/app-token-ring/s4u-app-token-ring.cpp index 8e76889a5f..fd0d1269e6 100644 --- a/examples/s4u/app-token-ring/s4u-app-token-ring.cpp +++ b/examples/s4u/app-token-ring/s4u-app-token-ring.cpp @@ -28,13 +28,13 @@ public: throw std::invalid_argument(std::string("Processes of this example must have a numerical name, not ") + ia.what()); } - my_mailbox = simgrid::s4u::Mailbox::byName(std::to_string(rank)); + my_mailbox = simgrid::s4u::Mailbox::by_name(std::to_string(rank)); if (rank + 1 == simgrid::s4u::Engine::get_instance()->get_host_count()) /* The last process, which sends the token back to rank 0 */ - neighbor_mailbox = simgrid::s4u::Mailbox::byName("0"); + neighbor_mailbox = simgrid::s4u::Mailbox::by_name("0"); else /* The others processes send to their right neighbor (rank+1) */ - neighbor_mailbox = simgrid::s4u::Mailbox::byName(std::to_string(rank + 1)); + neighbor_mailbox = simgrid::s4u::Mailbox::by_name(std::to_string(rank + 1)); if (rank == 0) { /* The root process (rank 0) first sends the token then waits to receive it back */ diff --git a/examples/s4u/async-wait/s4u-async-wait.cpp b/examples/s4u/async-wait/s4u-async-wait.cpp index b2f5a11a7f..91e9224318 100644 --- a/examples/s4u/async-wait/s4u-async-wait.cpp +++ b/examples/s4u/async-wait/s4u-async-wait.cpp @@ -31,7 +31,7 @@ static int sender(int argc, char** argv) for (int i = 0; i < messages_count; i++) { std::string mboxName = std::string("receiver-") + std::to_string(i % receivers_count); - simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::byName(mboxName); + simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::by_name(mboxName); std::string msgName = std::string("Message ") + std::to_string(i); std::string* payload = new std::string(msgName); // copy the data we send: // 'msgName' is not a stable storage location @@ -45,7 +45,7 @@ static int sender(int argc, char** argv) /* Start sending messages to let the workers know that they should stop */ for (int i = 0; i < receivers_count; i++) { std::string mboxName = std::string("receiver-") + std::to_string(i % receivers_count); - simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::byName(mboxName); + simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::by_name(mboxName); std::string* payload = new std::string("finalize"); // Make a copy of the data we will send simgrid::s4u::CommPtr comm = mbox->put_async(payload, 0); @@ -69,7 +69,7 @@ static int sender(int argc, char** argv) static int receiver(int argc, char** argv) { xbt_assert(argc == 2, "Expecting one parameter from the XML deployment file but got %d", argc); - simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::byName(std::string("receiver-") + argv[1]); + simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::by_name(std::string("receiver-") + argv[1]); XBT_INFO("Wait for my first message"); for (bool cont = true; cont;) { diff --git a/examples/s4u/async-waitall/s4u-async-waitall.cpp b/examples/s4u/async-waitall/s4u-async-waitall.cpp index a6762bc75d..6ac940dcf0 100644 --- a/examples/s4u/async-waitall/s4u-async-waitall.cpp +++ b/examples/s4u/async-waitall/s4u-async-waitall.cpp @@ -40,7 +40,7 @@ public: for (int i = 0; i < messages_count; i++) { std::string mboxName = std::string("receiver-") + std::to_string(i % receivers_count); - simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::byName(mboxName); + simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::by_name(mboxName); std::string msgName = std::string("Message ") + std::to_string(i); std::string* payload = new std::string(msgName); // copy the data we send: // 'msgName' is not a stable storage location @@ -54,7 +54,7 @@ public: /* Start sending messages to let the workers know that they should stop */ for (int i = 0; i < receivers_count; i++) { std::string mboxName = std::string("receiver-") + std::to_string(i % receivers_count); - simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::byName(mboxName); + simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::by_name(mboxName); std::string* payload = new std::string("finalize"); // Make a copy of the data we will send simgrid::s4u::CommPtr comm = mbox->put_async(payload, 0); @@ -79,7 +79,7 @@ public: { xbt_assert(args.size() == 2, "Expecting one parameter from the XML deployment file but got %zu", args.size()); std::string mboxName = std::string("receiver-") + args[1]; - mbox = simgrid::s4u::Mailbox::byName(mboxName); + mbox = simgrid::s4u::Mailbox::by_name(mboxName); } void operator()() { diff --git a/examples/s4u/async-waitany/s4u-async-waitany.cpp b/examples/s4u/async-waitany/s4u-async-waitany.cpp index 32b53e3739..afcbc90379 100644 --- a/examples/s4u/async-waitany/s4u-async-waitany.cpp +++ b/examples/s4u/async-waitany/s4u-async-waitany.cpp @@ -45,7 +45,7 @@ public: for (int i = 0; i < messages_count; i++) { std::string mboxName = std::string("receiver-") + std::to_string(i % receivers_count); - simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::byName(mboxName); + simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::by_name(mboxName); std::string msgName = std::string("Message ") + std::to_string(i); std::string* payload = new std::string(msgName); // copy the data we send: // 'msgName' is not a stable storage location @@ -59,7 +59,7 @@ public: /* Start sending messages to let the workers know that they should stop */ for (int i = 0; i < receivers_count; i++) { std::string mboxName = std::string("receiver-") + std::to_string(i % receivers_count); - simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::byName(mboxName); + simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::by_name(mboxName); std::string* payload = new std::string("finalize"); // Make a copy of the data we will send simgrid::s4u::CommPtr comm = mbox->put_async(payload, 0); @@ -95,7 +95,7 @@ public: { xbt_assert(args.size() == 2, "Expecting one parameter from the XML deployment file but got %zu", args.size()); std::string mboxName = std::string("receiver-") + args[1]; - mbox = simgrid::s4u::Mailbox::byName(mboxName); + mbox = simgrid::s4u::Mailbox::by_name(mboxName); } void operator()() { diff --git a/examples/s4u/cloud-simple/s4u-cloud-simple.cpp b/examples/s4u/cloud-simple/s4u-cloud-simple.cpp index 6487b3268d..e8cd04a13a 100644 --- a/examples/s4u/cloud-simple/s4u-cloud-simple.cpp +++ b/examples/s4u/cloud-simple/s4u-cloud-simple.cpp @@ -32,7 +32,7 @@ struct s_payload { static void communication_tx_fun(std::vector args) { - simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::byName(args.at(0)); + simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::by_name(args.at(0)); s_payload* payload = new s_payload; payload->tx_actor_name = simgrid::s4u::Actor::self()->get_cname(); payload->tx_host = simgrid::s4u::this_actor::get_host(); @@ -45,7 +45,7 @@ static void communication_rx_fun(std::vector args) { const char* actor_name = simgrid::s4u::Actor::self()->get_cname(); const char* host_name = simgrid::s4u::this_actor::get_host()->get_cname(); - simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::byName(args.at(0)); + simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::by_name(args.at(0)); struct s_payload* payload = static_cast(mbox->get()); double clock_end = simgrid::s4u::Engine::get_clock(); diff --git a/examples/s4u/dht-chord/s4u-dht-chord-node.cpp b/examples/s4u/dht-chord/s4u-dht-chord-node.cpp index d7ab98a633..e618a38516 100644 --- a/examples/s4u/dht-chord/s4u-dht-chord-node.cpp +++ b/examples/s4u/dht-chord/s4u-dht-chord-node.cpp @@ -53,7 +53,7 @@ Node::Node(std::vector args) // initialize my node id_ = std::stoi(args[1]); stream = simgrid::s4u::this_actor::get_host()->extension()->getStream(); - mailbox_ = simgrid::s4u::Mailbox::byName(std::to_string(id_)); + mailbox_ = simgrid::s4u::Mailbox::by_name(std::to_string(id_)); next_finger_to_fix = 0; fingers_ = new int[nb_bits]; @@ -117,7 +117,7 @@ void Node::notifyAndQuit() XBT_DEBUG("Sending a 'PREDECESSOR_LEAVING' to my successor %d", fingers_[0]); try { - simgrid::s4u::Mailbox::byName(std::to_string(fingers_[0]))->put(pred_msg, 10, timeout); + simgrid::s4u::Mailbox::by_name(std::to_string(fingers_[0]))->put(pred_msg, 10, timeout); } catch (xbt_ex& e) { if (e.category == timeout_error) { XBT_DEBUG("Timeout expired when sending a 'PREDECESSOR_LEAVING' to my successor %d", fingers_[0]); @@ -133,7 +133,7 @@ void Node::notifyAndQuit() XBT_DEBUG("Sending a 'SUCCESSOR_LEAVING' to my predecessor %d", pred_id_); try { - simgrid::s4u::Mailbox::byName(std::to_string(pred_id_))->put(succ_msg, 10, timeout); + simgrid::s4u::Mailbox::by_name(std::to_string(pred_id_))->put(succ_msg, 10, timeout); } catch (xbt_ex& e) { if (e.category == timeout_error) { XBT_DEBUG("Timeout expired when sending a 'SUCCESSOR_LEAVING' to my predecessor %d", pred_id_); @@ -216,8 +216,8 @@ void Node::checkPredecessor() if (pred_id_ == -1) return; - simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName(std::to_string(pred_id_)); - simgrid::s4u::MailboxPtr return_mailbox = simgrid::s4u::Mailbox::byName(std::to_string(id_) + "_is_alive"); + simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name(std::to_string(pred_id_)); + simgrid::s4u::MailboxPtr return_mailbox = simgrid::s4u::Mailbox::by_name(std::to_string(id_) + "_is_alive"); ChordMessage* message = new ChordMessage(PREDECESSOR_ALIVE); message->request_id = pred_id_; @@ -259,8 +259,8 @@ int Node::remoteGetPredecessor(int ask_to) { int predecessor_id = -1; void* data = nullptr; - simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName(std::to_string(ask_to)); - simgrid::s4u::MailboxPtr return_mailbox = simgrid::s4u::Mailbox::byName(std::to_string(id_) + "_pred"); + simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name(std::to_string(ask_to)); + simgrid::s4u::MailboxPtr return_mailbox = simgrid::s4u::Mailbox::by_name(std::to_string(id_) + "_pred"); ChordMessage* message = new ChordMessage(GET_PREDECESSOR); message->request_id = id_; @@ -335,8 +335,8 @@ int Node::remoteFindSuccessor(int ask_to, int id) { int successor = -1; void* data = nullptr; - simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName(std::to_string(ask_to)); - simgrid::s4u::MailboxPtr return_mailbox = simgrid::s4u::Mailbox::byName(std::to_string(id_) + "_succ"); + simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name(std::to_string(ask_to)); + simgrid::s4u::MailboxPtr return_mailbox = simgrid::s4u::Mailbox::by_name(std::to_string(id_) + "_succ"); ChordMessage* message = new ChordMessage(FIND_SUCCESSOR); message->request_id = id_; @@ -393,7 +393,7 @@ void Node::remoteNotify(int notify_id, int predecessor_candidate_id) // send a "Notify" request to notify_id XBT_DEBUG("Sending a 'Notify' request to %d", notify_id); - simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName(std::to_string(notify_id)); + simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name(std::to_string(notify_id)); mailbox->put_init(message, 10)->detach(ChordMessage::destroy); } @@ -440,7 +440,7 @@ void Node::handleMessage(ChordMessage* message) int closest = closestPrecedingFinger(message->request_id); XBT_DEBUG("Forwarding the 'Find Successor' request for id %d to my closest preceding finger %d", message->request_id, closest); - simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName(std::to_string(closest)); + simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name(std::to_string(closest)); mailbox->put_init(message, 10)->detach(ChordMessage::destroy); } break; diff --git a/examples/s4u/dht-kademlia/node.cpp b/examples/s4u/dht-kademlia/node.cpp index 2e3208c036..7e41353802 100644 --- a/examples/s4u/dht-kademlia/node.cpp +++ b/examples/s4u/dht-kademlia/node.cpp @@ -33,7 +33,7 @@ bool Node::join(unsigned int known_id) /* First step: Send a "FIND_NODE" request to the node we know */ sendFindNode(known_id, id_); - simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName(std::to_string(id_)); + simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name(std::to_string(id_)); do { if (receive_comm == nullptr) receive_comm = mailbox->get_async(&received_msg); @@ -79,9 +79,9 @@ bool Node::join(unsigned int known_id) void Node::sendFindNode(unsigned int id, unsigned int destination) { /* Gets the mailbox to send to */ - simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName(std::to_string(id)); + simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name(std::to_string(id)); /* Build the task */ - Message* msg = new Message(id_, destination, simgrid::s4u::Mailbox::byName(std::to_string(id_)), + Message* msg = new Message(id_, destination, simgrid::s4u::Mailbox::by_name(std::to_string(id_)), simgrid::s4u::Host::current()->get_cname()); /* Send the task */ @@ -200,7 +200,7 @@ bool Node::findNode(unsigned int id_to_find, bool count_in_stats) steps++; double time_beginreceive = simgrid::s4u::Engine::get_clock(); - simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName(std::to_string(id_)); + simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name(std::to_string(id_)); do { if (receive_comm == nullptr) receive_comm = mailbox->get_async(&received_msg); @@ -276,7 +276,7 @@ void Node::handleFindNode(Message* msg) // Building the answer to the request Message* answer = new Message(id_, msg->destination_id_, findClosest(msg->destination_id_), - simgrid::s4u::Mailbox::byName(std::to_string(id_)), simgrid::s4u::Host::current()->get_cname()); + simgrid::s4u::Mailbox::by_name(std::to_string(id_)), simgrid::s4u::Host::current()->get_cname()); // Sending the answer msg->answer_to_->put_init(answer, 1)->detach(kademlia::destroy); } diff --git a/examples/s4u/dht-kademlia/s4u-dht-kademlia.cpp b/examples/s4u/dht-kademlia/s4u-dht-kademlia.cpp index 89edd850f3..172292a3dc 100644 --- a/examples/s4u/dht-kademlia/s4u-dht-kademlia.cpp +++ b/examples/s4u/dht-kademlia/s4u-dht-kademlia.cpp @@ -44,7 +44,7 @@ static int node(int argc, char* argv[]) XBT_VERB("Main loop start"); - simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName(std::to_string(node->getId())); + simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name(std::to_string(node->getId())); while (simgrid::s4u::Engine::get_clock() < deadline) { if (node->receive_comm == nullptr) diff --git a/examples/s4u/energy-link/s4u-energy-link.cpp b/examples/s4u/energy-link/s4u-energy-link.cpp index 6de157cc32..a927e1f1b9 100644 --- a/examples/s4u/energy-link/s4u-energy-link.cpp +++ b/examples/s4u/energy-link/s4u-energy-link.cpp @@ -22,7 +22,7 @@ static void sender(std::vector args) double comm_size = std::stod(args.at(1)); XBT_INFO("Send %.0f bytes, in %d flows", comm_size, flow_amount); - simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName(std::string("message")); + simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name(std::string("message")); /* Sleep a while before starting the example */ simgrid::s4u::this_actor::sleep_for(10); @@ -48,7 +48,7 @@ static void receiver(std::vector args) XBT_INFO("Receiving %d flows ...", flow_amount); - simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName(std::string("message")); + simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name(std::string("message")); if (flow_amount == 1) { void* res = mailbox->get(); diff --git a/examples/s4u/replay-comm/s4u-replay-comm.cpp b/examples/s4u/replay-comm/s4u-replay-comm.cpp index 8cfd30946b..2152cb4624 100644 --- a/examples/s4u/replay-comm/s4u-replay-comm.cpp +++ b/examples/s4u/replay-comm/s4u-replay-comm.cpp @@ -62,7 +62,8 @@ public: double size = std::stod(action[3]); std::string* payload = new std::string(action[3]); double clock = simgrid::s4u::Engine::get_clock(); - simgrid::s4u::MailboxPtr to = simgrid::s4u::Mailbox::byName(simgrid::s4u::this_actor::get_name() + "_" + action[2]); + simgrid::s4u::MailboxPtr to = + simgrid::s4u::Mailbox::by_name(simgrid::s4u::this_actor::get_name() + "_" + action[2]); ACT_DEBUG("Entering Send: %s (size: %g) -- Actor %s on mailbox %s", NAME.c_str(), size, simgrid::s4u::this_actor::get_cname(), to->get_cname()); to->put(payload, size); @@ -75,7 +76,7 @@ public: { double clock = simgrid::s4u::Engine::get_clock(); simgrid::s4u::MailboxPtr from = - simgrid::s4u::Mailbox::byName(std::string(action[2]) + "_" + simgrid::s4u::this_actor::get_name()); + simgrid::s4u::Mailbox::by_name(std::string(action[2]) + "_" + simgrid::s4u::this_actor::get_name()); ACT_DEBUG("Receiving: %s -- Actor %s on mailbox %s", NAME.c_str(), simgrid::s4u::this_actor::get_cname(), from->get_cname()); diff --git a/include/simgrid/s4u/Mailbox.hpp b/include/simgrid/s4u/Mailbox.hpp index c7438ef0f7..687e78393c 100644 --- a/include/simgrid/s4u/Mailbox.hpp +++ b/include/simgrid/s4u/Mailbox.hpp @@ -117,26 +117,16 @@ public: /** private function, do not use. FIXME: make me protected */ kernel::activity::MailboxImpl* get_impl() { return pimpl_; } - XBT_ATTRIB_DEPRECATED_v323("Please use Mailbox::get_name()") const simgrid::xbt::string& getName() const - { - return get_name(); - } - XBT_ATTRIB_DEPRECATED_v323("Please use Mailbox::get_cname()") const char* getCname() const { return get_cname(); } - XBT_ATTRIB_DEPRECATED_v323("Please use Mailbox::get_impl()") kernel::activity::MailboxImpl* getImpl() - { - return get_impl(); - } - /** @brief Retrieves the name of that mailbox as a C++ string */ const simgrid::xbt::string& get_name() const; /** @brief Retrieves the name of that mailbox as a C string */ const char* get_cname() const; /** Retrieve the mailbox associated to the given C string */ - static MailboxPtr byName(const char *name); + static MailboxPtr by_name(const char* name); /** Retrieve the mailbox associated to the given C++ string */ - static MailboxPtr byName(std::string name); + static MailboxPtr by_name(std::string name); /** Returns whether the mailbox contains queued communications */ bool empty(); @@ -153,10 +143,10 @@ public: * its host even before he does a recv(). This models the real behavior of TCP * and MPI communications, amongst other. */ - void setReceiver(ActorPtr actor); + void set_receiver(ActorPtr actor); /** Return the actor declared as permanent receiver, or nullptr if none **/ - ActorPtr getReceiver(); + ActorPtr get_receiver(); /** Creates (but don't start) a data emission to that mailbox */ CommPtr put_init(); @@ -179,6 +169,30 @@ public: void* get(); // FIXME: make a typed template version /** Blocking data reception with timeout */ void* get(double timeout); + + // Deprecated functions + XBT_ATTRIB_DEPRECATED_v323("Please use Mailbox::set_receiver()") void setReceiver(ActorPtr actor) + { + set_receiver(actor); + } + XBT_ATTRIB_DEPRECATED_v323("Please use Mailbox::get_receiver()") ActorPtr getReceiver() { return get_receiver(); } + XBT_ATTRIB_DEPRECATED_v323("Please use Mailbox::get_name()") const simgrid::xbt::string& getName() const + { + return get_name(); + } + XBT_ATTRIB_DEPRECATED_v323("Please use Mailbox::get_cname()") const char* getCname() const { return get_cname(); } + XBT_ATTRIB_DEPRECATED_v323("Please use Mailbox::get_impl()") kernel::activity::MailboxImpl* getImpl() + { + return get_impl(); + } + XBT_ATTRIB_DEPRECATED_v323("Please use Mailbox::by_name()") static MailboxPtr byName(const char* name) + { + return by_name(name); + } + XBT_ATTRIB_DEPRECATED_v323("Please use Mailbox::by_name()") static MailboxPtr byName(std::string name) + { + return by_name(name); + } }; }} // namespace simgrid::s4u diff --git a/src/msg/msg_gos.cpp b/src/msg/msg_gos.cpp index 0769959348..dfc6ca9495 100644 --- a/src/msg/msg_gos.cpp +++ b/src/msg/msg_gos.cpp @@ -263,7 +263,7 @@ msg_error_t MSG_task_receive_ext_bounded(msg_task_t * task, const char *alias, d double rate) { XBT_DEBUG("MSG_task_receive_ext: Trying to receive a message on mailbox '%s'", alias); - simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName(alias); + simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name(alias); msg_error_t ret = MSG_OK; /* We no longer support getting a task from a specific host */ if (host) @@ -313,7 +313,7 @@ static inline msg_comm_t MSG_task_isend_internal(msg_task_t task, const char* al { simdata_task_t t_simdata = nullptr; msg_process_t myself = MSG_process_self(); - simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName(alias); + simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name(alias); TRACE_msg_task_put_start(task); /* Prepare the task to send */ @@ -452,7 +452,7 @@ msg_comm_t MSG_task_irecv(msg_task_t *task, const char *name) */ msg_comm_t MSG_task_irecv_bounded(msg_task_t *task, const char *name, double rate) { - simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::byName(name); + simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::by_name(name); /* FIXME: these functions are not traceable */ /* Sanity check */ @@ -778,7 +778,7 @@ msg_error_t MSG_task_send_with_timeout(msg_task_t task, const char *alias, doubl msg_error_t ret = MSG_OK; simdata_task_t t_simdata = nullptr; msg_process_t process = MSG_process_self(); - simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName(alias); + simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name(alias); TRACE_msg_task_put_start(task); @@ -858,7 +858,7 @@ msg_error_t MSG_task_send_with_timeout_bounded(msg_task_t task, const char *alia */ int MSG_task_listen(const char *alias) { - simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::byName(alias); + simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::by_name(alias); return mbox->listen() ? 1 : 0; } @@ -872,7 +872,7 @@ int MSG_task_listen(const char *alias) */ int MSG_task_listen_from(const char *alias) { - simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::byName(alias); + simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::by_name(alias); simgrid::kernel::activity::CommImplPtr comm = boost::static_pointer_cast(mbox->front()); diff --git a/src/msg/msg_mailbox.cpp b/src/msg/msg_mailbox.cpp index 0446eb9da3..12bb63293e 100644 --- a/src/msg/msg_mailbox.cpp +++ b/src/msg/msg_mailbox.cpp @@ -20,6 +20,6 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_mailbox, msg, "Logging specific to MSG (mail * \param alias The name of the mailbox */ void MSG_mailbox_set_async(const char *alias){ - simgrid::s4u::Mailbox::byName(alias)->setReceiver(simgrid::s4u::Actor::self()); + simgrid::s4u::Mailbox::by_name(alias)->set_receiver(simgrid::s4u::Actor::self()); XBT_VERB("%s mailbox set to receive eagerly for myself\n",alias); } diff --git a/src/plugins/vm/VmLiveMigration.cpp b/src/plugins/vm/VmLiveMigration.cpp index a6cfe1f7ab..55a01a9aa2 100644 --- a/src/plugins/vm/VmLiveMigration.cpp +++ b/src/plugins/vm/VmLiveMigration.cpp @@ -359,7 +359,7 @@ void sg_vm_migrate(simgrid::s4u::VirtualMachine* vm, simgrid::s4u::Host* dst_pm) /* wait until the migration have finished or on error has occurred */ XBT_DEBUG("wait for reception of the final ACK (i.e. migration has been correctly performed"); - simgrid::s4u::MailboxPtr mbox_ctl = simgrid::s4u::Mailbox::byName( + simgrid::s4u::MailboxPtr mbox_ctl = simgrid::s4u::Mailbox::by_name( std::string("__mbox_mig_ctl:") + vm->get_cname() + "(" + src_pm->get_cname() + "-" + dst_pm->get_cname() + ")"); delete static_cast(mbox_ctl->get()); tx->join(); diff --git a/src/plugins/vm/VmLiveMigration.hpp b/src/plugins/vm/VmLiveMigration.hpp index 257faeb776..f942710737 100644 --- a/src/plugins/vm/VmLiveMigration.hpp +++ b/src/plugins/vm/VmLiveMigration.hpp @@ -40,10 +40,10 @@ public: { src_pm_ = vm_->getPm(); - mbox_ctl = s4u::Mailbox::byName(std::string("__mbox_mig_ctl:") + vm_->get_cname() + "(" + src_pm_->get_cname() + - "-" + dst_pm_->get_cname() + ")"); - mbox = s4u::Mailbox::byName(std::string("__mbox_mig_src_dst:") + vm_->get_cname() + "(" + src_pm_->get_cname() + - "-" + dst_pm_->get_cname() + ")"); + mbox_ctl = s4u::Mailbox::by_name(std::string("__mbox_mig_ctl:") + vm_->get_cname() + "(" + src_pm_->get_cname() + + "-" + dst_pm_->get_cname() + ")"); + mbox = s4u::Mailbox::by_name(std::string("__mbox_mig_src_dst:") + vm_->get_cname() + "(" + src_pm_->get_cname() + + "-" + dst_pm_->get_cname() + ")"); } void operator()(); }; @@ -59,8 +59,8 @@ public: explicit MigrationTx(s4u::VirtualMachine* vm, s4u::Host* dst_pm) : vm_(vm), dst_pm_(dst_pm) { src_pm_ = vm_->getPm(); - mbox = s4u::Mailbox::byName(std::string("__mbox_mig_src_dst:") + vm_->get_cname() + "(" + src_pm_->get_cname() + - "-" + dst_pm_->get_cname() + ")"); + mbox = s4u::Mailbox::by_name(std::string("__mbox_mig_src_dst:") + vm_->get_cname() + "(" + src_pm_->get_cname() + + "-" + dst_pm_->get_cname() + ")"); } void operator()(); sg_size_t sendMigrationData(sg_size_t size, int stage, int stage2_round, double mig_speed, double timeout); diff --git a/src/s4u/s4u_Mailbox.cpp b/src/s4u/s4u_Mailbox.cpp index f57874e673..421486f48c 100644 --- a/src/s4u/s4u_Mailbox.cpp +++ b/src/s4u/s4u_Mailbox.cpp @@ -26,7 +26,7 @@ const char* Mailbox::get_cname() const return pimpl_->get_cname(); } -MailboxPtr Mailbox::byName(const char* name) +MailboxPtr Mailbox::by_name(const char* name) { kernel::activity::MailboxImpl* mbox = kernel::activity::MailboxImpl::byNameOrNull(name); if (mbox == nullptr) { @@ -35,9 +35,9 @@ MailboxPtr Mailbox::byName(const char* name) return MailboxPtr(&mbox->piface_, true); } -MailboxPtr Mailbox::byName(std::string name) +MailboxPtr Mailbox::by_name(std::string name) { - return byName(name.c_str()); + return by_name(name.c_str()); } bool Mailbox::empty() @@ -55,13 +55,13 @@ smx_activity_t Mailbox::front() return pimpl_->comm_queue.empty() ? nullptr : pimpl_->comm_queue.front(); } -void Mailbox::setReceiver(ActorPtr actor) +void Mailbox::set_receiver(ActorPtr actor) { simix::simcall([this, actor]() { this->pimpl_->setReceiver(actor); }); } /** @brief get the receiver (process associated to the mailbox) */ -ActorPtr Mailbox::getReceiver() +ActorPtr Mailbox::get_receiver() { if (pimpl_->permanent_receiver == nullptr) return ActorPtr(); diff --git a/src/smpi/internals/smpi_process.cpp b/src/smpi/internals/smpi_process.cpp index 15a6c1dc2c..603c39e37a 100644 --- a/src/smpi/internals/smpi_process.cpp +++ b/src/smpi/internals/smpi_process.cpp @@ -21,8 +21,8 @@ using simgrid::s4u::ActorPtr; Process::Process(ActorPtr actor, msg_bar_t finalization_barrier) : finalization_barrier_(finalization_barrier), actor_(actor) { - mailbox_ = simgrid::s4u::Mailbox::byName("SMPI-" + std::to_string(actor_->get_pid())); - mailbox_small_ = simgrid::s4u::Mailbox::byName("small-" + std::to_string(actor_->get_pid())); + mailbox_ = simgrid::s4u::Mailbox::by_name("SMPI-" + std::to_string(actor_->get_pid())); + mailbox_small_ = simgrid::s4u::Mailbox::by_name("small-" + std::to_string(actor_->get_pid())); mailboxes_mutex_ = xbt_mutex_init(); timer_ = xbt_os_timer_new(); state_ = SMPI_UNINITIALIZED; @@ -77,7 +77,7 @@ void Process::set_data(int* argc, char*** argv) argc_ = argc; argv_ = argv; // set the process attached to the mailbox - mailbox_small_->setReceiver(actor_); + mailbox_small_->set_receiver(actor_); XBT_DEBUG("<%ld> SMPI process has been initialized: %p", actor_->get_pid(), actor_.get()); } diff --git a/teshsuite/s4u/comm-pt2pt/comm-pt2pt.cpp b/teshsuite/s4u/comm-pt2pt/comm-pt2pt.cpp index f160b23200..648e9a27ed 100644 --- a/teshsuite/s4u/comm-pt2pt/comm-pt2pt.cpp +++ b/teshsuite/s4u/comm-pt2pt/comm-pt2pt.cpp @@ -51,7 +51,7 @@ static void sender(std::vector args) for (unsigned int test = 1; test <= args[0].size(); test++) { this_actor::sleep_until(test * 5 - 5); std::string* mboxName = new std::string("Test #" + std::to_string(test)); - simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::byName(mboxName->c_str()); + simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::by_name(mboxName->c_str()); switch (args[0][test - 1]) { case 'r': @@ -98,7 +98,7 @@ static void receiver(std::vector args) for (unsigned int test = 1; test <= args[0].size(); test++) { this_actor::sleep_until(test * 5 - 5); std::string mboxName = "Test #" + std::to_string(test); - simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::byName(mboxName.c_str()); + simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::by_name(mboxName.c_str()); void* received = nullptr; switch (args[0][test - 1]) { @@ -123,24 +123,24 @@ static void receiver(std::vector args) break; case 'p': XBT_INFO("Test %u: p (regular receive on permanent mailbox)", test); - mbox->setReceiver(Actor::self()); + mbox->set_receiver(Actor::self()); received = mbox->get(); break; case 'P': XBT_INFO("Test %u: P (sleep + regular receive on permanent mailbox)", test); simgrid::s4u::this_actor::sleep_for(0.5); - mbox->setReceiver(Actor::self()); + mbox->set_receiver(Actor::self()); received = mbox->get(); break; case 'j': XBT_INFO("Test %u: j (irecv on permanent mailbox)", test); - mbox->setReceiver(Actor::self()); + mbox->set_receiver(Actor::self()); mbox->get_async(&received)->wait(); break; case 'J': XBT_INFO("Test %u: J (sleep + irecv on permanent mailbox)", test); simgrid::s4u::this_actor::sleep_for(0.5); - mbox->setReceiver(Actor::self()); + mbox->set_receiver(Actor::self()); mbox->get_async(&received)->wait(); break; default: diff --git a/teshsuite/s4u/listen_async/listen_async.cpp b/teshsuite/s4u/listen_async/listen_async.cpp index c9ca453b1f..bd4dece255 100644 --- a/teshsuite/s4u/listen_async/listen_async.cpp +++ b/teshsuite/s4u/listen_async/listen_async.cpp @@ -15,7 +15,7 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_test, "Messages specific for this s4u example") static void server() { - simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName("mailbox"); + simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name("mailbox"); simgrid::s4u::CommPtr sendComm = mailbox->put_async(new std::string("Some data"), 0); @@ -28,8 +28,8 @@ static void server() delete res; sendComm->wait(); - simgrid::s4u::MailboxPtr mailbox2 = simgrid::s4u::Mailbox::byName("mailbox2"); - mailbox2->setReceiver(simgrid::s4u::Actor::self()); + simgrid::s4u::MailboxPtr mailbox2 = simgrid::s4u::Mailbox::by_name("mailbox2"); + mailbox2->set_receiver(simgrid::s4u::Actor::self()); mailbox2->put_init(new std::string("More data"), 0)->detach(); diff --git a/teshsuite/s4u/pid/pid.cpp b/teshsuite/s4u/pid/pid.cpp index b50bdbc4e2..7ae2222b6f 100644 --- a/teshsuite/s4u/pid/pid.cpp +++ b/teshsuite/s4u/pid/pid.cpp @@ -15,7 +15,7 @@ static int my_onexit(smx_process_exit_status_t /*status*/, int* pid) static void sendpid() { - simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName("mailbox"); + simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name("mailbox"); int pid = simgrid::s4u::this_actor::get_pid(); double comm_size = 100000; simgrid::s4u::this_actor::on_exit((int_f_pvoid_pvoid_t)my_onexit, &pid); @@ -29,7 +29,7 @@ static void sendpid() static void killall() { - simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName("mailbox"); + simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name("mailbox"); for (int i = 0; i < 3; i++) { int* pid = static_cast(mailbox->get()); XBT_INFO("Killing process \"%d\".", *pid); diff --git a/teshsuite/s4u/storage_client_server/storage_client_server.cpp b/teshsuite/s4u/storage_client_server/storage_client_server.cpp index 2cdf4b71b9..813b037344 100644 --- a/teshsuite/s4u/storage_client_server/storage_client_server.cpp +++ b/teshsuite/s4u/storage_client_server/storage_client_server.cpp @@ -52,7 +52,7 @@ static void hsm_put(const std::string& remote_host, const std::string& src, cons // Send file XBT_INFO("%s sends %llu to %s", simgrid::s4u::this_actor::get_cname(), read_size, remote_host.c_str()); std::string* payload = new std::string(simgrid::xbt::string_printf("%s %llu", dest.c_str(), read_size)); - simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName(remote_host); + simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name(remote_host); mailbox->put(payload, static_cast(read_size)); simgrid::s4u::this_actor::sleep_for(.4); } @@ -122,7 +122,7 @@ static void client() hsm_put("alice", "/home/doc/simgrid/examples/msg/parallel_task/test_ptask_deployment.xml", "c:\\Windows\\titi.xml"); hsm_put("alice", "/home/doc/simgrid/examples/msg/alias/masterslave_forwarder_with_alias.c", "c:\\Windows\\tata.c"); - simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName("alice"); + simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name("alice"); mailbox->put(new std::string("finalize"), 0); get_set_storage_data("Disk1"); @@ -131,7 +131,7 @@ static void client() static void server() { storage_info(simgrid::s4u::this_actor::get_host()); - simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName(simgrid::s4u::this_actor::get_host()->get_cname()); + simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name(simgrid::s4u::this_actor::get_host()->get_cname()); XBT_INFO("Server waiting for transfers ..."); while (1) { -- 2.20.1