From: Martin Quinson Date: Thu, 6 Jul 2017 07:39:55 +0000 (+0200) Subject: You don't send a mailbox, but instead put stuff on it X-Git-Tag: v3_17~446 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/dceed88b84f4c8dccf94f8031cc9ba635eaf75da?ds=sidebyside You don't send a mailbox, but instead put stuff on it this_actor::send(mailbox) is now mailbox->put() --- diff --git a/examples/s4u/actions-comm/s4u_actions-comm.cpp b/examples/s4u/actions-comm/s4u_actions-comm.cpp index bb7db5d830..644f266cce 100644 --- a/examples/s4u/actions-comm/s4u_actions-comm.cpp +++ b/examples/s4u/actions-comm/s4u_actions-comm.cpp @@ -64,7 +64,7 @@ public: simgrid::s4u::MailboxPtr to = simgrid::s4u::Mailbox::byName(simgrid::s4u::this_actor::name() + "_" + action[2]); ACT_DEBUG("Entering Send: %s (size: %g) -- Actor %s on mailbox %s", NAME, size, simgrid::s4u::this_actor::name().c_str(), to->name()); - to->send(payload, size); + to->put(payload, size); xbt_free(payload); log_action(action, simgrid::s4u::Engine::getClock() - clock); @@ -77,7 +77,7 @@ public: simgrid::s4u::Mailbox::byName(std::string(action[2]) + "_" + simgrid::s4u::this_actor::name()); ACT_DEBUG("Receiving: %s -- Actor %s on mailbox %s", NAME, simgrid::s4u::this_actor::name().c_str(), from->name()); - from->recv(); + from->get(); log_action(action, simgrid::s4u::Engine::getClock() - clock); } }; diff --git a/examples/s4u/actor-create/s4u_actor-create.cpp b/examples/s4u/actor-create/s4u_actor-create.cpp index 857b60a504..171935ac95 100644 --- a/examples/s4u/actor-create/s4u_actor-create.cpp +++ b/examples/s4u/actor-create/s4u_actor-create.cpp @@ -42,7 +42,7 @@ public: XBT_INFO("Hello s4u, I have something to send"); simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName("mb42"); - mailbox->send(xbt_strdup(msg.c_str()), msg.size()); + mailbox->put(xbt_strdup(msg.c_str()), msg.size()); XBT_INFO("I'm done. See you."); } }; @@ -74,8 +74,8 @@ public: { XBT_INFO("Hello s4u, I'm ready to get any message you'd want on %s", mailbox->name()); - char* msg1 = static_cast(mailbox->recv()); - char* msg2 = static_cast(mailbox->recv()); + char* msg1 = static_cast(mailbox->get()); + char* msg2 = static_cast(mailbox->get()); XBT_INFO("I received '%s' and '%s'", msg1, msg2); xbt_free(msg1); xbt_free(msg2); diff --git a/examples/s4u/app-masterworker/s4u_app-masterworker.cpp b/examples/s4u/app-masterworker/s4u_app-masterworker.cpp index d6797f709d..66c380f244 100644 --- a/examples/s4u/app-masterworker/s4u_app-masterworker.cpp +++ b/examples/s4u/app-masterworker/s4u_app-masterworker.cpp @@ -42,14 +42,14 @@ public: /* - Send the task to the @ref worker */ char* payload = bprintf("%f", comp_size); - mailbox->send(payload, comm_size); + mailbox->put(payload, comm_size); } 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->send(xbt_strdup("finalize"), 0); + mailbox->put(xbt_strdup("finalize"), 0); } } }; @@ -70,7 +70,7 @@ public: void operator()() { while (1) { /* The worker waits in an infinite loop for tasks sent by the \ref master */ - char* res = static_cast(mailbox->recv()); + char* res = static_cast(mailbox->get()); xbt_assert(res != nullptr, "MSG_task_get failed"); if (strcmp(res, "finalize") == 0) { /* - Exit if 'finalize' is received */ 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 d2c70ea96a..a5fc1670a1 100644 --- a/examples/s4u/app-token-ring/s4u_app-token-ring.cpp +++ b/examples/s4u/app-token-ring/s4u_app-token-ring.cpp @@ -36,15 +36,15 @@ public: if (rank == 0) { /* The root process (rank 0) first sends the token then waits to receive it back */ XBT_INFO("Host \"%u\" send 'Token' to Host \"%s\"", rank, neighbor_mailbox->name()); - neighbor_mailbox->send(xbt_strdup("Token"), task_comm_size); - char* res = static_cast(my_mailbox->recv()); + neighbor_mailbox->put(xbt_strdup("Token"), task_comm_size); + char* res = static_cast(my_mailbox->get()); XBT_INFO("Host \"%u\" received \"%s\"", rank, res); xbt_free(res); } else { - char* res = static_cast(my_mailbox->recv()); + char* res = static_cast(my_mailbox->get()); XBT_INFO("Host \"%u\" received \"%s\"", rank, res); XBT_INFO("Host \"%u\" send 'Token' to Host \"%s\"", rank, neighbor_mailbox->name()); - neighbor_mailbox->send(res, task_comm_size); + neighbor_mailbox->put(res, task_comm_size); } } }; diff --git a/examples/s4u/dht-chord/node.cpp b/examples/s4u/dht-chord/node.cpp index b45d46865b..79aef929aa 100644 --- a/examples/s4u/dht-chord/node.cpp +++ b/examples/s4u/dht-chord/node.cpp @@ -112,7 +112,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]))->send(pred_msg, 10, timeout); + simgrid::s4u::Mailbox::byName(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]); @@ -128,7 +128,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_))->send(succ_msg, 10, timeout); + simgrid::s4u::Mailbox::byName(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_); @@ -220,7 +220,7 @@ void Node::checkPredecessor() XBT_DEBUG("Sending a 'Predecessor Alive' request to my predecessor %d", pred_id_); try { - mailbox->send(message, 10, timeout); + mailbox->put(message, 10, timeout); } catch (xbt_ex& e) { if (e.category == timeout_error) { XBT_DEBUG("Failed to send the 'Predecessor Alive' request to %d", pred_id_); @@ -231,7 +231,7 @@ void Node::checkPredecessor() // receive the answer XBT_DEBUG("Sent 'Predecessor Alive' request to %d, waiting for the answer on my mailbox '%s'", pred_id_, message->answer_to->name()); - simgrid::s4u::CommPtr comm = return_mailbox->recv_async(&data); + simgrid::s4u::CommPtr comm = return_mailbox->get_async(&data); try { comm->wait(timeout); @@ -264,7 +264,7 @@ int Node::remoteGetPredecessor(int ask_to) // send a "Get Predecessor" request to ask_to_id XBT_DEBUG("Sending a 'Get Predecessor' request to %d", ask_to); try { - mailbox->send(message, 10, timeout); + mailbox->put(message, 10, timeout); } catch (xbt_ex& e) { if (e.category == timeout_error) { XBT_DEBUG("Failed to send the 'Get Predecessor' request to %d", ask_to); @@ -276,7 +276,7 @@ int Node::remoteGetPredecessor(int ask_to) // receive the answer XBT_DEBUG("Sent 'Get Predecessor' request to %d, waiting for the answer on my mailbox '%s'", ask_to, message->answer_to->name()); - simgrid::s4u::CommPtr comm = return_mailbox->recv_async(&data); + simgrid::s4u::CommPtr comm = return_mailbox->get_async(&data); try { comm->wait(timeout); @@ -340,7 +340,7 @@ int Node::remoteFindSuccessor(int ask_to, int id) // send a "Find Successor" request to ask_to_id XBT_DEBUG("Sending a 'Find Successor' request to %d for id %d", ask_to, id); try { - mailbox->send(message, 10, timeout); + mailbox->put(message, 10, timeout); } catch (xbt_ex& e) { if (e.category == timeout_error) { XBT_DEBUG("Failed to send the 'Find Successor' request to %d for id %d", ask_to, id_); @@ -350,7 +350,7 @@ int Node::remoteFindSuccessor(int ask_to, int id) } // receive the answer XBT_DEBUG("Sent a 'Find Successor' request to %d for key %d, waiting for the answer", ask_to, id); - simgrid::s4u::CommPtr comm = return_mailbox->recv_async(&data); + simgrid::s4u::CommPtr comm = return_mailbox->get_async(&data); try { comm->wait(timeout); @@ -389,7 +389,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)); - mailbox->send_init(message, 10)->detach(); + mailbox->put_init(message, 10)->detach(); } /* This function is called periodically. It checks the immediate successor of the current node. */ @@ -431,14 +431,14 @@ void Node::handleMessage(ChordMessage* message) message->answer_id = fingers_[0]; XBT_DEBUG("Sending back a 'Find Successor Answer' to %s (mailbox %s): the successor of %d is %d", message->issuer_host_name.c_str(), message->answer_to->name(), message->request_id, message->answer_id); - message->answer_to->send_init(message, 10)->detach(); + message->answer_to->put_init(message, 10)->detach(); } else { // otherwise, forward the request to the closest preceding finger in my table 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)); - mailbox->send_init(message, 10)->detach(); + mailbox->put_init(message, 10)->detach(); } break; @@ -448,7 +448,7 @@ void Node::handleMessage(ChordMessage* message) message->answer_id = pred_id_; XBT_DEBUG("Sending back a 'Get Predecessor Answer' to %s via mailbox '%s': my predecessor is %d", message->issuer_host_name.c_str(), message->answer_to->name(), message->answer_id); - message->answer_to->send_init(message, 10)->detach(); + message->answer_to->put_init(message, 10)->detach(); break; case NOTIFY: @@ -486,7 +486,7 @@ void Node::handleMessage(ChordMessage* message) message->type = PREDECESSOR_ALIVE_ANSWER; XBT_DEBUG("Sending back a 'Predecessor Alive Answer' to %s (mailbox %s)", message->issuer_host_name.c_str(), message->answer_to->name()); - message->answer_to->send_init(message, 10)->detach(); + message->answer_to->put_init(message, 10)->detach(); break; default: diff --git a/examples/s4u/dht-chord/s4u_dht-chord.hpp b/examples/s4u/dht-chord/s4u_dht-chord.hpp index 209aabcaad..77981dfa71 100644 --- a/examples/s4u/dht-chord/s4u_dht-chord.hpp +++ b/examples/s4u/dht-chord/s4u_dht-chord.hpp @@ -128,7 +128,7 @@ public: simgrid::s4u::CommPtr comm_receive = nullptr; while ((now < (start_time_ + deadline_)) && now < MAX_SIMULATION_TIME) { if (comm_receive == nullptr) - comm_receive = mailbox_->recv_async(&data); + comm_receive = mailbox_->get_async(&data); while ((now < (start_time_ + deadline_)) && now < MAX_SIMULATION_TIME && not comm_receive->test()) { // no task was received: make some periodic calls if (now >= next_stabilize_date) { diff --git a/include/simgrid/s4u/Actor.hpp b/include/simgrid/s4u/Actor.hpp index c205e6c5ce..eec45c1760 100644 --- a/include/simgrid/s4u/Actor.hpp +++ b/include/simgrid/s4u/Actor.hpp @@ -306,8 +306,8 @@ template inline void sleep_for(std::chrono::duration inline void sleep_for(std::chrono::durationsend_init(); + return dest->put_init(); } /** Creates (but don't start) an async send to the mailbox @p dest */ - static CommPtr XBT_ATTRIB_DEPRECATED("please use Mailbox::send_init") // 3.17 + static CommPtr XBT_ATTRIB_DEPRECATED("please use Mailbox::put_init") // 3.17 send_init(MailboxPtr dest, void* data, int simulatedByteAmount) { - return dest->send_init(data, simulatedByteAmount); + return dest->put_init(data, simulatedByteAmount); } /** Creates and start an async send to the mailbox @p dest */ - static CommPtr XBT_ATTRIB_DEPRECATED("please use Mailbox::send_async") // 3.17 + static CommPtr XBT_ATTRIB_DEPRECATED("please use Mailbox::put_async") // 3.17 send_async(MailboxPtr dest, void* data, int simulatedByteAmount) { - return dest->send_async(data, simulatedByteAmount); + return dest->put_async(data, simulatedByteAmount); } /** Creates (but don't start) an async recv onto the mailbox @p from */ - static CommPtr XBT_ATTRIB_DEPRECATED("please use Mailbox::recv_init") // 3.17 + static CommPtr XBT_ATTRIB_DEPRECATED("please use Mailbox::get_init") // 3.17 recv_init(MailboxPtr from) { - return from->recv_init(); + return from->get_init(); } /** Creates and start an async recv to the mailbox @p from */ - static CommPtr XBT_ATTRIB_DEPRECATED("please use Mailbox::recv_async") // 3.17 + static CommPtr XBT_ATTRIB_DEPRECATED("please use Mailbox::get_async") // 3.17 recv_async(MailboxPtr from, void** data) { - return from->recv_async(data); + return from->get_async(data); } void start() override; diff --git a/include/simgrid/s4u/Mailbox.hpp b/include/simgrid/s4u/Mailbox.hpp index 1abc9b2b1e..42e08f7bbd 100644 --- a/include/simgrid/s4u/Mailbox.hpp +++ b/include/simgrid/s4u/Mailbox.hpp @@ -149,27 +149,27 @@ public: /** Return the actor declared as permanent receiver, or nullptr if none **/ ActorPtr receiver(); - /** Creates (but don't start) an async send to that mailbox */ - CommPtr send_init(); - /** Creates (but don't start) an async send to that mailbox */ - CommPtr send_init(void* data, int simulatedByteAmount); - /** Creates and start an async send to that mailbox */ - CommPtr send_async(void* data, int simulatedByteAmount); - - /** Blocking send */ - void send(void* payload, double simulatedSize); - /** Blocking send with timeout */ - void send(void* payload, double simulatedSize, double timeout); - - /** Creates (but don't start) an async recv onto the mailbox @p from */ - CommPtr recv_init(); - /** Creates and start an async recv to the mailbox @p from */ - CommPtr recv_async(void** data); - - /** Blocking receive */ - void* recv(); - /** Blocking receive with timeout */ - void* recv(double timeout); + /** Creates (but don't start) an emission to that mailbox */ + CommPtr put_init(); + /** Creates (but don't start) an emission to that mailbox */ + CommPtr put_init(void* data, int simulatedByteAmount); + /** Creates and start an async emission to that mailbox */ + CommPtr put_async(void* data, int simulatedByteAmount); + + /** Blocking put */ + void put(void* payload, double simulatedSize); + /** Blocking put with timeout */ + void put(void* payload, double simulatedSize, double timeout); + + /** Creates (but don't start) a reception onto that mailbox */ + CommPtr get_init(); + /** Creates and start an async reception to that mailbox */ + CommPtr get_async(void** data); + + /** Blocking reception */ + void* get(); + /** Blocking reception with timeout */ + void* get(double timeout); }; }} // namespace simgrid::s4u diff --git a/src/s4u/s4u_actor.cpp b/src/s4u/s4u_actor.cpp index 8d05ad25bb..342bfb5aad 100644 --- a/src/s4u/s4u_actor.cpp +++ b/src/s4u/s4u_actor.cpp @@ -220,32 +220,32 @@ e_smx_state_t execute(double flops) { } void* recv(MailboxPtr chan) { - return chan->recv(); + return chan->get(); } void* recv(MailboxPtr chan, double timeout) { - return chan->recv(timeout); + return chan->get(timeout); } void send(MailboxPtr chan, void* payload, double simulatedSize) { - chan->send(payload, simulatedSize); + chan->put(payload, simulatedSize); } void send(MailboxPtr chan, void* payload, double simulatedSize, double timeout) { - chan->send(payload, simulatedSize, timeout); + chan->put(payload, simulatedSize, timeout); } CommPtr isend(MailboxPtr chan, void* payload, double simulatedSize) { - return chan->send_async(payload, simulatedSize); + return chan->put_async(payload, simulatedSize); } CommPtr irecv(MailboxPtr chan, void** data) { - return chan->recv_async(data); + return chan->get_async(data); } aid_t pid() diff --git a/src/s4u/s4u_mailbox.cpp b/src/s4u/s4u_mailbox.cpp index 9642de0274..f514ce5356 100644 --- a/src/s4u/s4u_mailbox.cpp +++ b/src/s4u/s4u_mailbox.cpp @@ -64,71 +64,71 @@ ActorPtr Mailbox::receiver() { return pimpl_->permanent_receiver->iface(); } -CommPtr Mailbox::send_init() +CommPtr Mailbox::put_init() { CommPtr res = CommPtr(new s4u::Comm()); res->sender_ = SIMIX_process_self(); res->mailbox_ = this; return res; } -s4u::CommPtr Mailbox::send_init(void* data, int simulatedSize) +s4u::CommPtr Mailbox::put_init(void* data, int simulatedSize) { - s4u::CommPtr res = send_init(); + s4u::CommPtr res = put_init(); res->setRemains(simulatedSize); res->srcBuff_ = data; res->srcBuffSize_ = sizeof(void*); return res; } -s4u::CommPtr Mailbox::send_async(void* data, int simulatedSize) +s4u::CommPtr Mailbox::put_async(void* data, int simulatedSize) { - s4u::CommPtr res = send_init(data, simulatedSize); + s4u::CommPtr res = put_init(data, simulatedSize); res->start(); return res; } -void Mailbox::send(void* payload, double simulatedSize) +void Mailbox::put(void* payload, double simulatedSize) { - CommPtr c = send_init(); + CommPtr c = put_init(); c->setRemains(simulatedSize); c->setSrcData(payload); c->wait(); } /** Blocking send with timeout */ -void Mailbox::send(void* payload, double simulatedSize, double timeout) +void Mailbox::put(void* payload, double simulatedSize, double timeout) { - CommPtr c = send_init(); + CommPtr c = put_init(); c->setRemains(simulatedSize); c->setSrcData(payload); // c->start() is optional. c->wait(timeout); } -s4u::CommPtr Mailbox::recv_init() +s4u::CommPtr Mailbox::get_init() { CommPtr res = CommPtr(new s4u::Comm()); res->receiver_ = SIMIX_process_self(); res->mailbox_ = this; return res; } -s4u::CommPtr Mailbox::recv_async(void** data) +s4u::CommPtr Mailbox::get_async(void** data) { - s4u::CommPtr res = recv_init(); + s4u::CommPtr res = get_init(); res->setDstData(data, sizeof(*data)); res->start(); return res; } -void* Mailbox::recv() +void* Mailbox::get() { void* res = nullptr; - CommPtr c = recv_init(); + CommPtr c = get_init(); c->setDstData(&res, sizeof(res)); c->wait(); return res; } -void* Mailbox::recv(double timeout) +void* Mailbox::get(double timeout) { void* res = nullptr; - CommPtr c = recv_init(); + CommPtr c = get_init(); c->setDstData(&res, sizeof(res)); c->wait(timeout); return res; diff --git a/teshsuite/s4u/comm-pt2pt/comm-pt2pt.cpp b/teshsuite/s4u/comm-pt2pt/comm-pt2pt.cpp index 84141ec172..6827ed4e46 100644 --- a/teshsuite/s4u/comm-pt2pt/comm-pt2pt.cpp +++ b/teshsuite/s4u/comm-pt2pt/comm-pt2pt.cpp @@ -56,32 +56,32 @@ static void sender(std::vector args) switch (args[0][test - 1]) { case 'r': XBT_INFO("Test %d: r (regular send)", test); - mbox->send((void*)mboxName, 42.0); + mbox->put((void*)mboxName, 42.0); break; case 'R': XBT_INFO("Test %d: R (sleep + regular send)", test); simgrid::s4u::this_actor::sleep_for(0.5); - mbox->send((void*)mboxName, 42.0); + mbox->put((void*)mboxName, 42.0); break; case 'i': XBT_INFO("Test %d: i (asynchronous isend)", test); - mbox->send_async((void*)mboxName, 42.0)->wait(); + mbox->put_async((void*)mboxName, 42.0)->wait(); break; case 'I': XBT_INFO("Test %d: I (sleep + isend)", test); simgrid::s4u::this_actor::sleep_for(0.5); - mbox->send_async((void*)mboxName, 42.0)->wait(); + mbox->put_async((void*)mboxName, 42.0)->wait(); break; case 'd': XBT_INFO("Test %d: d (detached send)", test); - mbox->send_init((void*)mboxName, 42.0)->detach(); + mbox->put_init((void*)mboxName, 42.0)->detach(); break; case 'D': XBT_INFO("Test %d: D (sleep + detached send)", test); simgrid::s4u::this_actor::sleep_for(0.5); - mbox->send_init((void*)mboxName, 42.0)->detach(); + mbox->put_init((void*)mboxName, 42.0)->detach(); break; default: xbt_die("Unknown sender spec for test %d: '%c'", test, args[0][test - 1]); @@ -104,44 +104,44 @@ static void receiver(std::vector args) switch (args[0][test - 1]) { case 'r': XBT_INFO("Test %d: r (regular receive)", test); - received = mbox->recv(); + received = mbox->get(); break; case 'R': XBT_INFO("Test %d: R (sleep + regular receive)", test); simgrid::s4u::this_actor::sleep_for(0.5); - received = mbox->recv(); + received = mbox->get(); break; case 'i': XBT_INFO("Test %d: i (asynchronous irecv)", test); - mbox->recv_async(&received)->wait(); + mbox->get_async(&received)->wait(); break; case 'I': XBT_INFO("Test %d: I (sleep + asynchronous irecv)", test); simgrid::s4u::this_actor::sleep_for(0.5); - mbox->recv_async(&received)->wait(); + mbox->get_async(&received)->wait(); break; case 'p': XBT_INFO("Test %d: p (regular receive on permanent mailbox)", test); mbox->setReceiver(Actor::self()); - received = mbox->recv(); + received = mbox->get(); break; case 'P': XBT_INFO("Test %d: P (sleep + regular receive on permanent mailbox)", test); simgrid::s4u::this_actor::sleep_for(0.5); mbox->setReceiver(Actor::self()); - received = mbox->recv(); + received = mbox->get(); break; case 'j': XBT_INFO("Test %d: j (irecv on permanent mailbox)", test); mbox->setReceiver(Actor::self()); - mbox->recv_async(&received)->wait(); + mbox->get_async(&received)->wait(); break; case 'J': XBT_INFO("Test %d: J (sleep + irecv on permanent mailbox)", test); simgrid::s4u::this_actor::sleep_for(0.5); mbox->setReceiver(Actor::self()); - mbox->recv_async(&received)->wait(); + mbox->get_async(&received)->wait(); break; default: xbt_die("Unknown receiver spec for test %d: '%c'", test, args[0][test - 1]); diff --git a/teshsuite/s4u/comm-waitany/comm-waitany.cpp b/teshsuite/s4u/comm-waitany/comm-waitany.cpp index a5e1d5ca00..6b9658317b 100644 --- a/teshsuite/s4u/comm-waitany/comm-waitany.cpp +++ b/teshsuite/s4u/comm-waitany/comm-waitany.cpp @@ -21,7 +21,7 @@ static void receiver() XBT_INFO("Placing %d asynchronous recv requests", NUM_COMMS); void* data; for (int i = 0; i < NUM_COMMS; i++) { - simgrid::s4u::CommPtr comm = mymailbox->recv_async(&data); + simgrid::s4u::CommPtr comm = mymailbox->get_async(&data); pending_comms.push_back(comm); } @@ -44,7 +44,7 @@ static void sender() for (int i = 0; i < NUM_COMMS; i++) { XBT_INFO("Sending a message to the receiver"); - theirmailbox->send(&data, 4); + theirmailbox->put(&data, 4); XBT_INFO("Sleeping for 1000 seconds"); simgrid::s4u::this_actor::sleep_for(1000.0); } diff --git a/teshsuite/s4u/listen_async/listen_async.cpp b/teshsuite/s4u/listen_async/listen_async.cpp index cfd90270b7..7e07dc9d46 100644 --- a/teshsuite/s4u/listen_async/listen_async.cpp +++ b/teshsuite/s4u/listen_async/listen_async.cpp @@ -17,11 +17,11 @@ static void server() { simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName("mailbox"); - simgrid::s4u::CommPtr sendComm = mailbox->send_async(xbt_strdup("Some data"), 0); + simgrid::s4u::CommPtr sendComm = mailbox->put_async(xbt_strdup("Some data"), 0); xbt_assert(mailbox->listen()); // True (1) XBT_INFO("Task listen works on regular mailboxes"); - char* res = static_cast(mailbox->recv()); + char* res = static_cast(mailbox->get()); xbt_assert(not strcmp("Some data", res), "Data received: %s", res); XBT_INFO("Data successfully received from regular mailbox"); @@ -31,12 +31,12 @@ static void server() simgrid::s4u::MailboxPtr mailbox2 = simgrid::s4u::Mailbox::byName("mailbox2"); mailbox2->setReceiver(simgrid::s4u::Actor::self()); - mailbox2->send_init(xbt_strdup("More data"), 0)->detach(); + mailbox2->put_init(xbt_strdup("More data"), 0)->detach(); xbt_assert(mailbox2->listen()); // used to break. XBT_INFO("Task listen works on asynchronous mailboxes"); - res = static_cast(mailbox2->recv()); + res = static_cast(mailbox2->get()); xbt_assert(not strcmp("More data", res)); xbt_free(res); diff --git a/teshsuite/s4u/pid/pid.cpp b/teshsuite/s4u/pid/pid.cpp index d92d7d5a06..2624b07990 100644 --- a/teshsuite/s4u/pid/pid.cpp +++ b/teshsuite/s4u/pid/pid.cpp @@ -21,7 +21,7 @@ static void sendpid() simgrid::s4u::this_actor::onExit((int_f_pvoid_pvoid_t)my_onexit, &pid); XBT_INFO("Sending pid of \"%d\".", pid); - mailbox->send(&pid, comm_size); + mailbox->put(&pid, comm_size); XBT_INFO("Send of pid \"%d\" done.", pid); simgrid::s4u::this_actor::suspend(); @@ -31,7 +31,7 @@ static void killall() { simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName("mailbox"); for (int i = 0; i < 3; i++) { - int* pid = static_cast(mailbox->recv()); + int* pid = static_cast(mailbox->get()); XBT_INFO("Killing process \"%d\".", *pid); simgrid::s4u::Actor::byPid(*pid)->kill(); } diff --git a/teshsuite/s4u/storage_client_server/storage_client_server.cpp b/teshsuite/s4u/storage_client_server/storage_client_server.cpp index 85eabc7569..569b8cc98c 100644 --- a/teshsuite/s4u/storage_client_server/storage_client_server.cpp +++ b/teshsuite/s4u/storage_client_server/storage_client_server.cpp @@ -56,7 +56,7 @@ static void hsm_put(const char* remote_host, const char* src, const char* dest) XBT_INFO("%s sends %llu to %s", simgrid::s4u::this_actor::name().c_str(), read_size, remote_host); char* payload = bprintf("%s %llu", dest, read_size); simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName(remote_host); - mailbox->send(payload, static_cast(read_size)); + mailbox->put(payload, static_cast(read_size)); simgrid::s4u::this_actor::sleep_for(.4); } @@ -130,7 +130,7 @@ static void client() 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"); - mailbox->send(xbt_strdup("finalize"), 0); + mailbox->put(xbt_strdup("finalize"), 0); get_set_storage_data("Disk1"); } @@ -142,7 +142,7 @@ static void server() XBT_INFO("Server waiting for transfers ..."); while (1) { - char* msg = static_cast(mailbox->recv()); + char* msg = static_cast(mailbox->get()); if (not strcmp(msg, "finalize")) { // Shutdown ... xbt_free(msg); break;