Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
MailboxPtr looks like a smart pointer, but it's not. Kill it.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 12 Mar 2019 09:53:17 +0000 (10:53 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 12 Mar 2019 15:41:48 +0000 (16:41 +0100)
45 files changed:
docs/source/Tutorial_Algorithms.rst
docs/source/app_s4u.rst
docs/source/tuto_s4u/master-workers-lab1.cpp
docs/source/tuto_s4u/master-workers-lab2.cpp
docs/source/tuto_s4u/master-workers-lab3.cpp
docs/source/tuto_s4u/master-workers-lab4.cpp
examples/s4u/actor-create/s4u-actor-create.cpp
examples/s4u/app-bittorrent/s4u-bittorrent.hpp
examples/s4u/app-bittorrent/s4u-peer.cpp
examples/s4u/app-bittorrent/s4u-peer.hpp
examples/s4u/app-bittorrent/s4u-tracker.hpp
examples/s4u/app-chainsend/s4u-app-chainsend.cpp
examples/s4u/app-masterworkers/s4u-app-masterworkers-class.cpp
examples/s4u/app-masterworkers/s4u-app-masterworkers-fun.cpp
examples/s4u/app-pingpong/s4u-app-pingpong.cpp
examples/s4u/app-token-ring/s4u-app-token-ring.cpp
examples/s4u/async-ready/s4u-async-ready.cpp
examples/s4u/async-wait/s4u-async-wait.cpp
examples/s4u/async-waitall/s4u-async-waitall.cpp
examples/s4u/async-waitany/s4u-async-waitany.cpp
examples/s4u/async-waituntil/s4u-async-waituntil.cpp
examples/s4u/cloud-simple/s4u-cloud-simple.cpp
examples/s4u/dht-chord/s4u-dht-chord-node.cpp
examples/s4u/dht-chord/s4u-dht-chord.hpp
examples/s4u/dht-kademlia/message.hpp
examples/s4u/dht-kademlia/node.cpp
examples/s4u/dht-kademlia/s4u-dht-kademlia.cpp
examples/s4u/energy-link/s4u-energy-link.cpp
examples/s4u/platform-failures/s4u-platform-failures.cpp
examples/s4u/replay-comm/s4u-replay-comm.cpp
include/simgrid/forward.h
include/simgrid/s4u/Comm.hpp
include/simgrid/s4u/Mailbox.hpp
src/kernel/activity/MailboxImpl.hpp
src/msg/msg_task.cpp
src/plugins/vm/VmLiveMigration.cpp
src/plugins/vm/VmLiveMigration.hpp
src/s4u/s4u_Comm.cpp
src/s4u/s4u_Mailbox.cpp
src/smpi/include/smpi_actor.hpp
src/smpi/mpi/smpi_request.cpp
teshsuite/s4u/comm-pt2pt/comm-pt2pt.cpp
teshsuite/s4u/listen_async/listen_async.cpp
teshsuite/s4u/pid/pid.cpp
teshsuite/s4u/storage_client_server/storage_client_server.cpp

index e12657f..feb034a 100644 (file)
@@ -461,7 +461,7 @@ messages to all workers based on their number, for example as follows:
    for (int i = 0; i < tasks_count; i++) {
      std::string worker_rank          = std::to_string(i % workers_count);
      std::string mailbox_name         = std::string("worker-") + worker_rank;
-     simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name(mailbox_name);
+     simgrid::s4u::Mailbox* mailbox = simgrid::s4u::Mailbox::by_name(mailbox_name);
 
      mailbox->put(...);
 
index 3f3aaec..3c8c206 100644 (file)
@@ -507,8 +507,6 @@ s4u::Mailbox
 
 Please also refer to the :ref:`full doc on s4u::Mailbox <s4u_mailbox>`.
 
-.. doxygentypedef:: MailboxPtr
-
 .. doxygenclass:: simgrid::s4u::Mailbox
    :members:
    :protected-members:
index dc97047..9a40c14 100644 (file)
@@ -31,7 +31,7 @@ static void master(std::vector<std::string> args)
     /* - Select a worker in a round-robin way */
     std::string worker_rank          = std::to_string(i % workers_count);
     std::string mailbox_name         = std::string("worker-") + worker_rank;
-    simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name(mailbox_name);
+    simgrid::s4u::Mailbox* mailbox   = simgrid::s4u::Mailbox::by_name(mailbox_name);
 
     /* - Send the computation cost to that worker */
     XBT_INFO("Sending task %d of %ld to mailbox '%s'", i, tasks_count, mailbox->get_cname());
@@ -42,7 +42,7 @@ static void master(std::vector<std::string> args)
   for (int i = 0; i < workers_count; i++) {
     /* The workers stop when receiving a negative compute_cost */
     std::string mailbox_name         = std::string("worker-") + std::to_string(i);
-    simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name(mailbox_name);
+    simgrid::s4u::Mailbox* mailbox   = simgrid::s4u::Mailbox::by_name(mailbox_name);
 
     mailbox->put(new double(-1.0), 0);
   }
@@ -54,7 +54,7 @@ static void worker(std::vector<std::string> args)
   long id = std::stol(args[1]);
 
   const std::string mailbox_name   = std::string("worker-") + std::to_string(id);
-  simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name(mailbox_name);
+  simgrid::s4u::Mailbox* mailbox   = simgrid::s4u::Mailbox::by_name(mailbox_name);
 
   double compute_cost;
   do {
index f9e17d3..9380eb2 100644 (file)
@@ -19,7 +19,7 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_app_masterworker, "Messages specific for this e
 static void worker()
 {
   const std::string mailbox_name   = std::string("worker-") + std::to_string(simgrid::s4u::this_actor::get_pid());
-  simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name(mailbox_name);
+  simgrid::s4u::Mailbox* mailbox   = simgrid::s4u::Mailbox::by_name(mailbox_name);
 
   double compute_cost;
   do {
@@ -56,7 +56,7 @@ static void master(std::vector<std::string> args)
     /* - Select a worker in a round-robin way */
     aid_t worker_pid                 = actors.at(i % actors.size())->get_pid();
     std::string mailbox_name         = std::string("worker-") + std::to_string(worker_pid);
-    simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name(mailbox_name);
+    simgrid::s4u::Mailbox* mailbox   = simgrid::s4u::Mailbox::by_name(mailbox_name);
 
     /* - Send the computation cost to that worker */
     XBT_INFO("Sending task %d of %ld to mailbox '%s'", i, tasks_count, mailbox->get_cname());
@@ -67,7 +67,7 @@ static void master(std::vector<std::string> args)
   for (unsigned long i = 0; i < actors.size(); i++) {
     /* The workers stop when receiving a negative compute_cost */
     std::string mailbox_name         = std::string("worker-") + std::to_string(actors.at(i)->get_pid());
-    simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name(mailbox_name);
+    simgrid::s4u::Mailbox* mailbox   = simgrid::s4u::Mailbox::by_name(mailbox_name);
 
     mailbox->put(new double(-1.0), 0);
   }
index 6d65782..2f439be 100644 (file)
@@ -19,7 +19,7 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_app_masterworker, "Messages specific for this e
 static void worker()
 {
   const std::string mailbox_name   = std::string("worker-") + std::to_string(simgrid::s4u::this_actor::get_pid());
-  simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name(mailbox_name);
+  simgrid::s4u::Mailbox* mailbox   = simgrid::s4u::Mailbox::by_name(mailbox_name);
 
   while (true) { // Master forcefully kills the workers by the end of the simulation
     double* msg  = static_cast<double*>(mailbox->get());
@@ -54,7 +54,7 @@ static void master(std::vector<std::string> args)
     /* - Select a worker in a round-robin way */
     aid_t worker_pid                 = actors.at(task_id % actors.size())->get_pid();
     std::string mailbox_name         = std::string("worker-") + std::to_string(worker_pid);
-    simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name(mailbox_name);
+    simgrid::s4u::Mailbox* mailbox   = simgrid::s4u::Mailbox::by_name(mailbox_name);
 
     /* - Send the computation cost to that worker */
     if (task_id % 100 == 0)
index 3861d79..819fd4e 100644 (file)
@@ -19,7 +19,7 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_app_masterworker, "Messages specific for this e
 static void worker(std::string category)
 {
   const std::string mailbox_name   = std::string("worker-") + std::to_string(simgrid::s4u::this_actor::get_pid());
-  simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name(mailbox_name);
+  simgrid::s4u::Mailbox* mailbox   = simgrid::s4u::Mailbox::by_name(mailbox_name);
 
   while (true) { // Master forcefully kills the workers by the end of the simulation
     double* msg         = static_cast<double*>(mailbox->get());
@@ -60,7 +60,7 @@ static void master(std::vector<std::string> args)
     /* - Select a worker in a round-robin way */
     aid_t worker_pid                 = actors.at(task_id % actors.size())->get_pid();
     std::string mailbox_name         = std::string("worker-") + std::to_string(worker_pid);
-    simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name(mailbox_name);
+    simgrid::s4u::Mailbox* mailbox   = simgrid::s4u::Mailbox::by_name(mailbox_name);
 
     /* - Send the computation cost to that worker */
     XBT_DEBUG("Sending task %d to mailbox '%s'", task_id, mailbox->get_cname());
index 43cd620..b587f42 100644 (file)
@@ -29,7 +29,7 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_actor_create, "The logging channel used in this
  */
 static void receiver(const std::string& mailbox_name)
 {
-  simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name(mailbox_name);
+  simgrid::s4u::Mailbox* 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(const 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::by_name(argv[1]);
-  simgrid::s4u::MailboxPtr out = simgrid::s4u::Mailbox::by_name(argv[2]);
+  simgrid::s4u::Mailbox* in    = simgrid::s4u::Mailbox::by_name(argv[1]);
+  simgrid::s4u::Mailbox* out   = simgrid::s4u::Mailbox::by_name(argv[2]);
   std::string* msg             = static_cast<std::string*>(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::by_name(mbox);
+    simgrid::s4u::Mailbox* mailbox = simgrid::s4u::Mailbox::by_name(mbox);
 
     mailbox->put(new std::string(msg), msg.size());
     XBT_INFO("I'm done. See you.");
index 69759e6..19551d0 100644 (file)
@@ -56,16 +56,16 @@ class Message {
 public:
   e_message_type type;
   int peer_id;
-  simgrid::s4u::MailboxPtr return_mailbox;
+  simgrid::s4u::Mailbox* return_mailbox;
   unsigned int bitfield = 0U;
   int piece             = 0;
   int block_index       = 0;
   int block_length      = 0;
-  Message(e_message_type type, int peer_id, simgrid::s4u::MailboxPtr return_mailbox)
+  Message(e_message_type type, int peer_id, simgrid::s4u::Mailbox* return_mailbox)
       : type(type), peer_id(peer_id), return_mailbox(return_mailbox){};
-  Message(e_message_type type, int peer_id, unsigned int bitfield, simgrid::s4u::MailboxPtr return_mailbox)
+  Message(e_message_type type, int peer_id, unsigned int bitfield, simgrid::s4u::Mailbox* return_mailbox)
       : type(type), peer_id(peer_id), return_mailbox(return_mailbox), bitfield(bitfield){};
-  Message(e_message_type type, int peer_id, simgrid::s4u::MailboxPtr return_mailbox, int piece, int block_index,
+  Message(e_message_type type, int peer_id, simgrid::s4u::Mailbox* return_mailbox, int piece, int block_index,
           int block_length)
       : type(type)
       , peer_id(peer_id)
@@ -73,7 +73,7 @@ public:
       , piece(piece)
       , block_index(block_index)
       , block_length(block_length){};
-  Message(e_message_type type, int peer_id, simgrid::s4u::MailboxPtr return_mailbox, int piece)
+  Message(e_message_type type, int peer_id, simgrid::s4u::Mailbox* return_mailbox, int piece)
       : type(type), peer_id(peer_id), return_mailbox(return_mailbox), piece(piece){};
   ~Message() = default;
 };
index d36aae4..f28d40b 100644 (file)
@@ -85,7 +85,7 @@ void Peer::operator()()
 
 bool Peer::getPeersFromTracker()
 {
-  simgrid::s4u::MailboxPtr tracker_mailbox = simgrid::s4u::Mailbox::by_name(TRACKER_MAILBOX);
+  simgrid::s4u::Mailbox* 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 {
@@ -121,14 +121,14 @@ void Peer::sendHandshakeToAllPeers()
   }
 }
 
-void Peer::sendMessage(simgrid::s4u::MailboxPtr mailbox, e_message_type type, uint64_t size)
+void Peer::sendMessage(simgrid::s4u::Mailbox* mailbox, e_message_type type, uint64_t size)
 {
   const char* type_names[6] = {"HANDSHAKE", "CHOKE", "UNCHOKE", "INTERESTED", "NOTINTERESTED", "CANCEL"};
   XBT_DEBUG("Sending %s to %s", type_names[type], mailbox->get_cname());
   mailbox->put_init(new Message(type, id, bitfield_, mailbox_), size)->detach();
 }
 
-void Peer::sendBitfield(simgrid::s4u::MailboxPtr mailbox)
+void Peer::sendBitfield(simgrid::s4u::Mailbox* mailbox)
 {
   XBT_DEBUG("Sending a BITFIELD to %s", mailbox->get_cname());
   mailbox
@@ -137,7 +137,7 @@ void Peer::sendBitfield(simgrid::s4u::MailboxPtr mailbox)
       ->detach();
 }
 
-void Peer::sendPiece(simgrid::s4u::MailboxPtr mailbox, unsigned int piece, int block_index, int block_length)
+void Peer::sendPiece(simgrid::s4u::Mailbox* mailbox, unsigned int piece, int block_index, int block_length)
 {
   xbt_assert(not hasNotPiece(piece), "Tried to send a unavailable piece.");
   XBT_DEBUG("Sending the PIECE %u (%d,%d) to %s", piece, block_index, block_length, mailbox->get_cname());
index d77c4ba..2d9eb6a 100644 (file)
@@ -13,7 +13,7 @@
 class Connection {
 public:
   int id; // Peer id
-  simgrid::s4u::MailboxPtr mailbox_;
+  simgrid::s4u::Mailbox* mailbox_;
   unsigned int bitfield = 0U; // Fields
   //  int messages_count;
   double peer_speed    = 0;
@@ -34,7 +34,7 @@ class Peer {
   int id;
   double deadline;
   RngStream stream;
-  simgrid::s4u::MailboxPtr mailbox_;
+  simgrid::s4u::Mailbox* mailbox_;
   std::unordered_map<int, Connection*> connected_peers;
   std::set<Connection*> active_peers; // active peers list
 
@@ -77,9 +77,9 @@ public:
   void requestNewPieceTo(Connection* remote_peer);
 
   bool getPeersFromTracker();
-  void sendMessage(simgrid::s4u::MailboxPtr mailbox, e_message_type type, uint64_t size);
-  void sendBitfield(simgrid::s4u::MailboxPtr mailbox);
-  void sendPiece(simgrid::s4u::MailboxPtr mailbox, unsigned int piece, int block_index, int block_length);
+  void sendMessage(simgrid::s4u::Mailbox* mailbox, e_message_type type, uint64_t size);
+  void sendBitfield(simgrid::s4u::Mailbox* mailbox);
+  void sendPiece(simgrid::s4u::Mailbox* mailbox, unsigned int piece, int block_index, int block_length);
   void sendHandshakeToAllPeers();
   void sendHaveToAllPeers(unsigned int piece);
   void sendRequestTo(Connection* remote_peer, unsigned int piece);
index 27c025e..4755919 100644 (file)
 
 class TrackerQuery {
   int peer_id; // peer id
-  simgrid::s4u::MailboxPtr return_mailbox;
+  simgrid::s4u::Mailbox* return_mailbox;
+
 public:
-  explicit TrackerQuery(int peer_id, simgrid::s4u::MailboxPtr return_mailbox)
+  explicit TrackerQuery(int peer_id, simgrid::s4u::Mailbox* return_mailbox)
       : peer_id(peer_id), return_mailbox(return_mailbox){};
   ~TrackerQuery() = default;
   int getPeerId() { return peer_id; }
-  simgrid::s4u::MailboxPtr getReturnMailbox() { return return_mailbox; }
+  simgrid::s4u::Mailbox* getReturnMailbox() { return return_mailbox; }
 };
 
 class TrackerAnswer {
@@ -36,7 +37,7 @@ public:
 class Tracker {
   double deadline;
   RngStream stream;
-  simgrid::s4u::MailboxPtr mailbox;
+  simgrid::s4u::Mailbox* mailbox;
   std::set<int> known_peers;
 
 public:
index 39ee01d..dcf8e3c 100644 (file)
@@ -14,10 +14,10 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_chainsend, "Messages specific for chainsend");
 
 class ChainMessage {
 public:
-  simgrid::s4u::MailboxPtr prev_ = nullptr;
-  simgrid::s4u::MailboxPtr next_ = nullptr;
+  simgrid::s4u::Mailbox* prev_   = nullptr;
+  simgrid::s4u::Mailbox* next_   = nullptr;
   unsigned int num_pieces        = 0;
-  explicit ChainMessage(simgrid::s4u::MailboxPtr prev, simgrid::s4u::MailboxPtr next, const unsigned int num_pieces)
+  explicit ChainMessage(simgrid::s4u::Mailbox* prev, simgrid::s4u::Mailbox* next, const unsigned int num_pieces)
       : prev_(prev), next_(next), num_pieces(num_pieces)
   {
   }
@@ -32,9 +32,9 @@ public:
 
 class Peer {
 public:
-  simgrid::s4u::MailboxPtr prev = nullptr;
-  simgrid::s4u::MailboxPtr next = nullptr;
-  simgrid::s4u::MailboxPtr me   = nullptr;
+  simgrid::s4u::Mailbox* prev = nullptr;
+  simgrid::s4u::Mailbox* next = nullptr;
+  simgrid::s4u::Mailbox* me   = nullptr;
   std::vector<simgrid::s4u::CommPtr> pending_recvs;
   std::vector<simgrid::s4u::CommPtr> pending_sends;
 
@@ -90,20 +90,20 @@ public:
 
 class Broadcaster {
 public:
-  simgrid::s4u::MailboxPtr first = nullptr;
-  std::vector<simgrid::s4u::MailboxPtr> mailboxes;
+  simgrid::s4u::Mailbox* first = nullptr;
+  std::vector<simgrid::s4u::Mailbox*> mailboxes;
   unsigned int piece_count;
 
   void buildChain()
   {
     auto cur                      = mailboxes.begin();
-    simgrid::s4u::MailboxPtr prev = nullptr;
-    simgrid::s4u::MailboxPtr last = nullptr;
+    simgrid::s4u::Mailbox* prev   = nullptr;
+    simgrid::s4u::Mailbox* last   = nullptr;
 
     /* Build the chain if there's at least one peer */
     if (cur != mailboxes.end()) {
       /* init: prev=NULL, host=current cur, next=next cur */
-      simgrid::s4u::MailboxPtr next = *cur;
+      simgrid::s4u::Mailbox* next   = *cur;
       first                         = next;
 
       /* This iterator iterates one step ahead: cur is current iterated element, but is actually next in the chain */
@@ -111,7 +111,7 @@ public:
         /* following steps: prev=last, host=next, next=cur */
         ++cur;
         prev                                     = last;
-        simgrid::s4u::MailboxPtr current_mailbox = next;
+        simgrid::s4u::Mailbox* current_mailbox   = next;
         if (cur != mailboxes.end())
           next = *cur;
         else
index c320b67..a91f203 100644 (file)
@@ -15,7 +15,7 @@ class Master {
   long tasks_count                 = 0;
   double compute_cost              = 0;
   double communicate_cost          = 0;
-  std::vector<simgrid::s4u::MailboxPtr> workers;
+  std::vector<simgrid::s4u::Mailbox*> workers;
 
 public:
   explicit Master(std::vector<std::string> args)
@@ -35,7 +35,7 @@ public:
   {
     for (int i = 0; i < tasks_count; i++) { /* For each task to be executed: */
       /* - Select a worker in a round-robin way */
-      simgrid::s4u::MailboxPtr mailbox = workers[i % workers.size()];
+      simgrid::s4u::Mailbox* mailbox = workers[i % workers.size()];
 
       /* - Send the computation amount to the worker */
       if (tasks_count < 10000 || (tasks_count < 100000 && i % 10000 == 0) || i % 100000 == 0)
@@ -46,14 +46,14 @@ public:
     XBT_INFO("All tasks have been dispatched. Request all workers to stop.");
     for (unsigned int i = 0; i < workers.size(); i++) {
       /* The workers stop when receiving a negative compute_cost */
-      simgrid::s4u::MailboxPtr mailbox = workers[i % workers.size()];
+      simgrid::s4u::Mailbox* mailbox = workers[i % workers.size()];
       mailbox->put(new double(-1.0), 0);
     }
   }
 };
 
 class Worker {
-  simgrid::s4u::MailboxPtr mailbox = nullptr;
+  simgrid::s4u::Mailbox* mailbox = nullptr;
 
 public:
   explicit Worker(std::vector<std::string> args)
index fefc90c..40780fc 100644 (file)
@@ -19,7 +19,7 @@ static void master(std::vector<std::string> args)
   long tasks_count          = std::stol(args[1]);
   double compute_cost       = std::stod(args[2]);
   double communication_cost = std::stod(args[3]);
-  std::vector<simgrid::s4u::MailboxPtr> workers;
+  std::vector<simgrid::s4u::Mailbox*> workers;
   for (unsigned int i = 4; i < args.size(); i++)
     workers.push_back(simgrid::s4u::Mailbox::by_name(args[i]));
 
@@ -27,7 +27,7 @@ static void master(std::vector<std::string> args)
 
   for (int i = 0; i < tasks_count; i++) { /* For each task to be executed: */
     /* - Select a worker in a round-robin way */
-    simgrid::s4u::MailboxPtr mailbox = workers[i % workers.size()];
+    simgrid::s4u::Mailbox* mailbox = workers[i % workers.size()];
 
     /* - Send the computation cost to that worker */
     XBT_INFO("Sending task %d of %ld to mailbox '%s'", i, tasks_count, mailbox->get_cname());
@@ -37,7 +37,7 @@ static void master(std::vector<std::string> args)
   XBT_INFO("All tasks have been dispatched. Request all workers to stop.");
   for (unsigned int i = 0; i < workers.size(); i++) {
     /* The workers stop when receiving a negative compute_cost */
-    simgrid::s4u::MailboxPtr mailbox = workers[i % workers.size()];
+    simgrid::s4u::Mailbox* mailbox = workers[i % workers.size()];
 
     mailbox->put(new double(-1.0), 0);
   }
@@ -50,7 +50,7 @@ static void worker(std::vector<std::string> args)
   xbt_assert(args.size() == 1, "The worker expects no argument");
 
   simgrid::s4u::Host* my_host      = simgrid::s4u::this_actor::get_host();
-  simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name(my_host->get_name());
+  simgrid::s4u::Mailbox* mailbox   = simgrid::s4u::Mailbox::by_name(my_host->get_name());
 
   double compute_cost;
   do {
index c9bb2e8..019d6b2 100644 (file)
@@ -7,7 +7,7 @@
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_app_pingpong, "Messages specific for this s4u example");
 
-static void pinger(simgrid::s4u::MailboxPtr mailbox_in, simgrid::s4u::MailboxPtr mailbox_out)
+static void pinger(simgrid::s4u::Mailbox* mailbox_in, simgrid::s4u::Mailbox* mailbox_out)
 {
   XBT_INFO("Ping from mailbox %s to mailbox %s", mailbox_in->get_name().c_str(), mailbox_out->get_name().c_str());
 
@@ -25,7 +25,7 @@ static void pinger(simgrid::s4u::MailboxPtr mailbox_in, simgrid::s4u::MailboxPtr
   delete sender_time;
 }
 
-static void ponger(simgrid::s4u::MailboxPtr mailbox_in, simgrid::s4u::MailboxPtr mailbox_out)
+static void ponger(simgrid::s4u::Mailbox* mailbox_in, simgrid::s4u::Mailbox* mailbox_out)
 {
   XBT_INFO("Pong from mailbox %s to mailbox %s", mailbox_in->get_name().c_str(), mailbox_out->get_name().c_str());
 
@@ -49,8 +49,8 @@ int main(int argc, char* argv[])
   simgrid::s4u::Engine e(&argc, argv);
   e.load_platform(argv[1]);
 
-  simgrid::s4u::MailboxPtr mb1 = simgrid::s4u::Mailbox::by_name("Mailbox 1");
-  simgrid::s4u::MailboxPtr mb2 = simgrid::s4u::Mailbox::by_name("Mailbox 2");
+  simgrid::s4u::Mailbox* mb1 = simgrid::s4u::Mailbox::by_name("Mailbox 1");
+  simgrid::s4u::Mailbox* mb2 = simgrid::s4u::Mailbox::by_name("Mailbox 2");
 
   simgrid::s4u::Actor::create("pinger", simgrid::s4u::Host::by_name("Tremblay"), pinger, mb1, mb2);
   simgrid::s4u::Actor::create("ponger", simgrid::s4u::Host::by_name("Jupiter"), ponger, mb2, mb1);
index 3a2a02d..2774114 100644 (file)
@@ -13,8 +13,8 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_app_token_ring, "Messages specific for this s4u
 
 class RelayRunner {
   size_t task_comm_size = 1000000; /* The token is 1MB long*/
-  simgrid::s4u::MailboxPtr my_mailbox;
-  simgrid::s4u::MailboxPtr neighbor_mailbox;
+  simgrid::s4u::Mailbox* my_mailbox;
+  simgrid::s4u::Mailbox* neighbor_mailbox;
   unsigned int rank      = 0;
 
 public:
index f796ace..1736753 100644 (file)
@@ -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<simgrid::s4u::CommPtr> 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);
index 0d377bb..2898edb 100644 (file)
@@ -29,7 +29,7 @@ static int sender(int argc, char** argv)
   std::vector<simgrid::s4u::CommPtr> pending_comms;
 
   /* Make a vector of the mailboxes to use */
-  std::vector<simgrid::s4u::MailboxPtr> mboxes;
+  std::vector<simgrid::s4u::Mailbox*> mboxes;
   for (int i = 0; i < receivers_count; i++)
     mboxes.push_back(simgrid::s4u::Mailbox::by_name(std::string("receiver-") + std::to_string(i)));
 
@@ -70,7 +70,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::by_name(std::string("receiver-") + argv[1]);
+  simgrid::s4u::Mailbox* mbox = simgrid::s4u::Mailbox::by_name(std::string("receiver-") + argv[1]);
 
   XBT_INFO("Wait for my first message");
   for (bool cont = true; cont;) {
index fafc4ca..e3d83cf 100644 (file)
@@ -39,7 +39,7 @@ public:
     std::vector<simgrid::s4u::CommPtr> pending_comms;
 
     /* Make a vector of the mailboxes to use */
-    std::vector<simgrid::s4u::MailboxPtr> mboxes;
+    std::vector<simgrid::s4u::Mailbox*> mboxes;
     for (int i = 0; i < receivers_count; i++)
       mboxes.push_back(simgrid::s4u::Mailbox::by_name(std::string("receiver-") + std::to_string(i)));
     // sphinx-doc: init-end
@@ -76,7 +76,7 @@ public:
 
 /* Receiver actor expects 1 argument: its ID */
 class Receiver {
-  simgrid::s4u::MailboxPtr mbox;
+  simgrid::s4u::Mailbox* mbox;
 
 public:
   explicit Receiver(std::vector<std::string> args)
index 9b6a62e..4d3b1fa 100644 (file)
@@ -43,7 +43,7 @@ public:
     std::vector<simgrid::s4u::CommPtr> pending_comms;
 
     /* Make a vector of the mailboxes to use */
-    std::vector<simgrid::s4u::MailboxPtr> mboxes;
+    std::vector<simgrid::s4u::Mailbox*> mboxes;
     for (int i = 0; i < receivers_count; i++)
       mboxes.push_back(simgrid::s4u::Mailbox::by_name(std::string("receiver-") + std::to_string(i)));
 
@@ -89,7 +89,7 @@ public:
 
 /* Receiver actor expects 1 argument: its ID */
 class Receiver {
-  simgrid::s4u::MailboxPtr mbox;
+  simgrid::s4u::Mailbox* mbox;
 
 public:
   explicit Receiver(std::vector<std::string> args)
index 296ef1d..f741f5a 100644 (file)
@@ -30,7 +30,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::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* payload          = new std::string(msgName); // copy the data we send:
     // 'msgName' is not a stable storage location
@@ -44,7 +44,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::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
 
     simgrid::s4u::CommPtr comm = mbox->put_async(payload, 0);
@@ -68,7 +68,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::by_name(std::string("receiver-") + argv[1]);
+  simgrid::s4u::Mailbox* mbox = simgrid::s4u::Mailbox::by_name(std::string("receiver-") + argv[1]);
 
   XBT_INFO("Wait for my first message");
   for (bool cont = true; cont;) {
index b6113ab..08a341a 100644 (file)
@@ -32,7 +32,7 @@ struct s_payload {
 
 static void communication_tx_fun(std::vector<std::string> args)
 {
-  simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::by_name(args.at(0));
+  simgrid::s4u::Mailbox* 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<std::string> 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::by_name(args.at(0));
+  simgrid::s4u::Mailbox* mbox   = simgrid::s4u::Mailbox::by_name(args.at(0));
 
   struct s_payload* payload = static_cast<struct s_payload*>(mbox->get());
   double clock_end          = simgrid::s4u::Engine::get_clock();
index 52a0d55..f69461b 100644 (file)
@@ -212,8 +212,8 @@ void Node::checkPredecessor()
   if (pred_id_ == -1)
     return;
 
-  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");
+  simgrid::s4u::Mailbox* mailbox        = simgrid::s4u::Mailbox::by_name(std::to_string(pred_id_));
+  simgrid::s4u::Mailbox* return_mailbox = simgrid::s4u::Mailbox::by_name(std::to_string(id_) + "_is_alive");
 
   ChordMessage* message = new ChordMessage(PREDECESSOR_ALIVE);
   message->request_id   = pred_id_;
@@ -252,8 +252,8 @@ int Node::remoteGetPredecessor(int ask_to)
 {
   int predecessor_id                      = -1;
   void* data                              = nullptr;
-  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");
+  simgrid::s4u::Mailbox* mailbox          = simgrid::s4u::Mailbox::by_name(std::to_string(ask_to));
+  simgrid::s4u::Mailbox* return_mailbox   = simgrid::s4u::Mailbox::by_name(std::to_string(id_) + "_pred");
 
   ChordMessage* message = new ChordMessage(GET_PREDECESSOR);
   message->request_id   = id_;
@@ -324,8 +324,8 @@ int Node::remoteFindSuccessor(int ask_to, int id)
 {
   int successor                           = -1;
   void* data                              = nullptr;
-  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");
+  simgrid::s4u::Mailbox* mailbox          = simgrid::s4u::Mailbox::by_name(std::to_string(ask_to));
+  simgrid::s4u::Mailbox* return_mailbox   = simgrid::s4u::Mailbox::by_name(std::to_string(id_) + "_succ");
 
   ChordMessage* message = new ChordMessage(FIND_SUCCESSOR);
   message->request_id   = id_;
@@ -379,7 +379,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::by_name(std::to_string(notify_id));
+  simgrid::s4u::Mailbox* mailbox = simgrid::s4u::Mailbox::by_name(std::to_string(notify_id));
   mailbox->put_init(message, 10)->detach(ChordMessage::destroy);
 }
 
@@ -426,7 +426,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::by_name(std::to_string(closest));
+      simgrid::s4u::Mailbox* mailbox = simgrid::s4u::Mailbox::by_name(std::to_string(closest));
       mailbox->put_init(message, 10)->detach(ChordMessage::destroy);
     }
     break;
index 7db25b1..c071fe2 100644 (file)
@@ -61,7 +61,7 @@ public:
   int request_id     = -1;            // id (used by some types of messages)
   int request_finger = 1;             // finger parameter (used by some types of messages)
   int answer_id      = -1;            // answer (used by some types of messages)
-  simgrid::s4u::MailboxPtr answer_to; // mailbox to send an answer to (if any)
+  simgrid::s4u::Mailbox* answer_to;   // mailbox to send an answer to (if any)
 
   explicit ChordMessage(e_message_type_t type)
       : type(type), issuer_host_name(simgrid::s4u::this_actor::get_host()->get_name())
@@ -80,7 +80,7 @@ class Node {
   bool joined        = false;
   int id_;                           // my id
   int pred_id_ = -1;                 // predecessor id
-  simgrid::s4u::MailboxPtr mailbox_; // my mailbox
+  simgrid::s4u::Mailbox* mailbox_;   // my mailbox
   int* fingers_;                     // finger table,(fingers[0] is my successor)
   int next_finger_to_fix;            // index of the next finger to fix in fix_fingers()
   RngStream stream;
index 9e32c59..c1b6434 100644 (file)
@@ -18,11 +18,11 @@ public:
   unsigned int sender_id_             = 0;       // Id of the guy who sent the task
   unsigned int destination_id_        = 0;       // Id we are trying to find, if needed.
   Answer* answer_                     = nullptr; // Answer to the request made, if needed.
-  simgrid::s4u::MailboxPtr answer_to_ = nullptr; // mailbox to send the answer to (if not an answer).
+  simgrid::s4u::Mailbox* answer_to_   = nullptr; // mailbox to send the answer to (if not an answer).
   std::string issuer_host_name_;                 // used for logging
 
-  explicit Message(unsigned int sender_id, unsigned int destination_id, Answer* answer,
-                   simgrid::s4u::MailboxPtr mailbox, const char* hostname)
+  explicit Message(unsigned int sender_id, unsigned int destination_id, Answer* answer, simgrid::s4u::Mailbox* mailbox,
+                   const char* hostname)
       : sender_id_(sender_id)
       , destination_id_(destination_id)
       , answer_(answer)
@@ -30,7 +30,7 @@ public:
       , issuer_host_name_(hostname)
   {
   }
-  explicit Message(unsigned int sender_id, unsigned int destination_id, simgrid::s4u::MailboxPtr mailbox,
+  explicit Message(unsigned int sender_id, unsigned int destination_id, simgrid::s4u::Mailbox* mailbox,
                    const char* hostname)
       : Message(sender_id, destination_id, nullptr, mailbox, hostname)
   {
index 7956ded..2f7a756 100644 (file)
@@ -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::by_name(std::to_string(id_));
+  simgrid::s4u::Mailbox* mailbox = simgrid::s4u::Mailbox::by_name(std::to_string(id_));
   do {
     if (receive_comm == nullptr)
       receive_comm = mailbox->get_async(&received_msg);
@@ -79,7 +79,7 @@ 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::by_name(std::to_string(id));
+  simgrid::s4u::Mailbox* mailbox = simgrid::s4u::Mailbox::by_name(std::to_string(id));
   /* Build the task */
   Message* msg = new Message(id_, destination, simgrid::s4u::Mailbox::by_name(std::to_string(id_)),
                              simgrid::s4u::Host::current()->get_cname());
@@ -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::by_name(std::to_string(id_));
+    simgrid::s4u::Mailbox* mailbox = simgrid::s4u::Mailbox::by_name(std::to_string(id_));
     do {
       if (receive_comm == nullptr)
         receive_comm = mailbox->get_async(&received_msg);
index 29d8d2b..c6c8fc1 100644 (file)
@@ -44,7 +44,7 @@ static int node(int argc, char* argv[])
 
     XBT_VERB("Main loop start");
 
-    simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name(std::to_string(node->getId()));
+    simgrid::s4u::Mailbox* mailbox = simgrid::s4u::Mailbox::by_name(std::to_string(node->getId()));
 
     while (simgrid::s4u::Engine::get_clock() < deadline) {
       if (node->receive_comm == nullptr)
index aba6b01..e765771 100644 (file)
@@ -22,7 +22,7 @@ static void sender(std::vector<std::string> 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::by_name(std::string("message"));
+  simgrid::s4u::Mailbox* 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<std::string> args)
 
   XBT_INFO("Receiving %d flows ...", flow_amount);
 
-  simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name(std::string("message"));
+  simgrid::s4u::Mailbox* mailbox = simgrid::s4u::Mailbox::by_name(std::string("message"));
 
   if (flow_amount == 1) {
     void* res = mailbox->get();
index cd949f8..f0150d8 100644 (file)
@@ -25,7 +25,7 @@ static int master(int argc, char* argv[])
 {
   xbt_assert(argc == 5, "Expecting one parameter");
 
-  simgrid::s4u::MailboxPtr mailbox;
+  simgrid::s4u::Mailbox* mailbox;
   long number_of_tasks = xbt_str_parse_int(argv[1], "Invalid amount of tasks: %s");
   double comp_size     = xbt_str_parse_double(argv[2], "Invalid computational size: %s");
   double comm_size     = xbt_str_parse_double(argv[3], "Invalid communication size: %s");
@@ -84,7 +84,7 @@ static int worker(int argc, char* argv[])
 {
   xbt_assert(argc == 2, "Expecting one parameter");
   long id                          = xbt_str_parse_int(argv[1], "Invalid argument %s");
-  simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name(std::string("worker-") + std::to_string(id));
+  simgrid::s4u::Mailbox* mailbox   = simgrid::s4u::Mailbox::by_name(std::string("worker-") + std::to_string(id));
   double* payload                  = nullptr;
   double comp_size                 = -1;
   while (1) {
index 491c3a8..2b73587 100644 (file)
@@ -55,8 +55,7 @@ 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::by_name(simgrid::s4u::this_actor::get_name() + "_" + action[2]);
+    simgrid::s4u::Mailbox* 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);
@@ -68,7 +67,7 @@ public:
   static void recv(simgrid::xbt::ReplayAction& action)
   {
     double clock = simgrid::s4u::Engine::get_clock();
-    simgrid::s4u::MailboxPtr from =
+    simgrid::s4u::Mailbox* from =
         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(),
index fa40a14..e92b3a7 100644 (file)
@@ -62,10 +62,6 @@ XBT_PUBLIC void intrusive_ptr_add_ref(Io* i);
 class Link;
 
 class Mailbox;
-/** Smart pointer to a simgrid::s4u::Mailbox */
-typedef boost::intrusive_ptr<Mailbox> MailboxPtr;
-XBT_PUBLIC void intrusive_ptr_release(Mailbox* m);
-XBT_PUBLIC void intrusive_ptr_add_ref(Mailbox* m);
 
 class Mutex;
 XBT_PUBLIC void intrusive_ptr_release(Mutex* m);
index d858df9..cdcd9f0 100644 (file)
@@ -19,7 +19,7 @@ namespace s4u {
  * Represents all asynchronous communications, that you can test or wait onto.
  */
 class XBT_PUBLIC Comm : public Activity {
-  MailboxPtr mailbox_                 = nullptr;
+  Mailbox* mailbox_                   = nullptr;
   kernel::actor::ActorImpl* sender_   = nullptr;
   kernel::actor::ActorImpl* receiver_ = nullptr;
   double rate_                        = -1;
@@ -112,7 +112,7 @@ public:
   CommPtr set_dst_data(void** buff, size_t size);
 
   /** Retrieve the mailbox on which this comm acts */
-  MailboxPtr get_mailbox();
+  Mailbox* get_mailbox();
   /** Retrieve the size of the received data. Not to be mixed with @ref Activity::set_remaining()  */
   size_t get_dst_data_size();
 
@@ -148,7 +148,7 @@ public:
   {
     return get_dst_data_size();
   }
-  XBT_ATTRIB_DEPRECATED_v323("Please use Comm::get_mailbox()") MailboxPtr getMailbox() { return get_mailbox(); }
+  XBT_ATTRIB_DEPRECATED_v323("Please use Comm::get_mailbox()") Mailbox* getMailbox() { return get_mailbox(); }
 #endif
 };
 } // namespace s4u
index 5be4b24..3f3475a 100644 (file)
@@ -23,11 +23,6 @@ class XBT_PUBLIC Mailbox {
 
   explicit Mailbox(kernel::activity::MailboxImpl * mbox) : pimpl_(mbox) {}
 
-  /** private function to manage the mailboxes' lifetime (see @ref s4u_raii) */
-  friend void intrusive_ptr_add_ref(Mailbox*) {}
-  /** private function to manage the mailboxes' lifetime (see @ref s4u_raii) */
-  friend void intrusive_ptr_release(Mailbox*) {}
-
 public:
   /** private function, do not use. FIXME: make me protected */
   kernel::activity::MailboxImpl* get_impl() { return pimpl_; }
@@ -38,7 +33,7 @@ public:
   const char* get_cname() const;
 
   /** Retrieve the mailbox associated to the given name */
-  static MailboxPtr by_name(const std::string& name);
+  static Mailbox* by_name(const std::string& name);
 
   /** Returns whether the mailbox contains queued communications */
   bool empty();
@@ -120,12 +115,12 @@ public:
     return get_impl();
   }
   /** @deprecated Mailbox::by_name() */
-  XBT_ATTRIB_DEPRECATED_v323("Please use Mailbox::by_name()") static MailboxPtr byName(const char* name)
+  XBT_ATTRIB_DEPRECATED_v323("Please use Mailbox::by_name()") static Mailbox* byName(const char* name)
   {
     return by_name(name);
   }
   /** @deprecated Mailbox::by_name() */
-  XBT_ATTRIB_DEPRECATED_v323("Please use Mailbox::by_name()") static MailboxPtr byName(const std::string& name)
+  XBT_ATTRIB_DEPRECATED_v323("Please use Mailbox::by_name()") static Mailbox* byName(const std::string& name)
   {
     return by_name(name);
   }
index 97b7576..0c8246b 100644 (file)
@@ -23,7 +23,7 @@ class MailboxImpl {
   static constexpr size_t MAX_MAILBOX_SIZE = 10000000;
 
   friend s4u::Mailbox;
-  friend s4u::MailboxPtr s4u::Mailbox::by_name(const std::string& name);
+  friend s4u::Mailbox* s4u::Mailbox::by_name(const std::string& name);
   friend mc::CommunicationDeterminismChecker;
 
   explicit MailboxImpl(const std::string& name)
index 89aecf6..6dfbfe2 100644 (file)
@@ -681,8 +681,6 @@ 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::by_name(name);
-
   /* FIXME: these functions are not traceable */
   /* Sanity check */
   xbt_assert(task, "Null pointer for the task storage");
index 825284f..a489757 100644 (file)
@@ -357,7 +357,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::by_name(
+  simgrid::s4u::Mailbox* 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<std::string*>(mbox_ctl->get());
   tx->join();
index daff0fb..fd84132 100644 (file)
@@ -28,9 +28,9 @@ public:
 
 class MigrationRx {
   /* The miration_rx process uses mbox_ctl to let the caller of do_migration()  know the completion of the migration. */
-  s4u::MailboxPtr mbox_ctl;
+  s4u::Mailbox* mbox_ctl;
   /* The migration_rx and migration_tx processes use mbox to transfer migration data. */
-  s4u::MailboxPtr mbox;
+  s4u::Mailbox* mbox;
   s4u::VirtualMachine* vm_;
   s4u::Host* src_pm_ = nullptr;
   s4u::Host* dst_pm_ = nullptr;
@@ -50,7 +50,7 @@ public:
 
 class MigrationTx {
   /* The migration_rx and migration_tx processes use mbox to transfer migration data. */
-  s4u::MailboxPtr mbox;
+  s4u::Mailbox* mbox;
   s4u::VirtualMachine* vm_;
   s4u::Host* src_pm_ = nullptr;
   s4u::Host* dst_pm_ = nullptr;
index 5ef3821..7aa422a 100644 (file)
@@ -222,7 +222,7 @@ bool Comm::test()
   return false;
 }
 
-MailboxPtr Comm::get_mailbox()
+Mailbox* Comm::get_mailbox()
 {
   return mailbox_;
 }
index 604cb6a..1661442 100644 (file)
@@ -25,13 +25,13 @@ const char* Mailbox::get_cname() const
   return pimpl_->get_cname();
 }
 
-MailboxPtr Mailbox::by_name(const std::string& name)
+Mailbox* Mailbox::by_name(const std::string& name)
 {
   kernel::activity::MailboxImpl* mbox = kernel::activity::MailboxImpl::by_name_or_null(name);
   if (mbox == nullptr) {
     mbox = simix::simcall([&name] { return kernel::activity::MailboxImpl::by_name_or_create(name); });
   }
-  return MailboxPtr(&mbox->piface_, true);
+  return &mbox->piface_;
 }
 
 bool Mailbox::empty()
index 1314d4b..5a2e333 100644 (file)
@@ -17,8 +17,8 @@ namespace smpi {
 class ActorExt {
 private:
   double simulated_ = 0 /* Used to time with simulated_start/elapsed */;
-  s4u::MailboxPtr mailbox_;
-  s4u::MailboxPtr mailbox_small_;
+  s4u::Mailbox* mailbox_;
+  s4u::Mailbox* mailbox_small_;
   s4u::MutexPtr mailboxes_mutex_;
   xbt_os_timer_t timer_;
   MPI_Comm comm_self_   = MPI_COMM_NULL;
@@ -58,8 +58,8 @@ public:
   smpi_trace_call_location_t* call_location();
   void set_privatized_region(smpi_privatization_region_t region);
   smpi_privatization_region_t privatized_region();
-  s4u::MailboxPtr mailbox() { return mailbox_; }
-  s4u::MailboxPtr mailbox_small() { return mailbox_small_; }
+  s4u::Mailbox* mailbox() { return mailbox_; }
+  s4u::Mailbox* mailbox_small() { return mailbox_small_; }
   s4u::MutexPtr mailboxes_mutex();
 #if HAVE_PAPI
   int papi_event_set();
index 8826c7c..b79810e 100644 (file)
@@ -360,7 +360,7 @@ void Request::sendrecv(void *sendbuf, int sendcount, MPI_Datatype sendtype,int d
 
 void Request::start()
 {
-  s4u::MailboxPtr mailbox;
+  s4u::Mailbox* mailbox;
 
   xbt_assert(action_ == nullptr, "Cannot (re-)start unfinished communication");
   flags_ &= ~MPI_REQ_PREPARED;
@@ -706,7 +706,7 @@ void Request::iprobe(int source, int tag, MPI_Comm comm, int* flag, MPI_Status*
         ->wait();
   }
   // behave like a receive, but don't do it
-  s4u::MailboxPtr mailbox;
+  s4u::Mailbox* mailbox;
 
   request->print_request("New iprobe");
   // We have to test both mailboxes as we don't know if we will receive one one or another
index bc625c9..756efd7 100644 (file)
@@ -49,7 +49,7 @@ static void sender(std::vector<std::string> args)
   for (unsigned int test = 1; test <= args[0].size(); test++) {
     simgrid::s4u::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::by_name(*mboxName);
+    simgrid::s4u::Mailbox* mbox   = simgrid::s4u::Mailbox::by_name(*mboxName);
 
     switch (args[0][test - 1]) {
       case 'r':
@@ -96,7 +96,7 @@ static void receiver(std::vector<std::string> args)
   for (unsigned int test = 1; test <= args[0].size(); test++) {
     simgrid::s4u::this_actor::sleep_until(test * 5 - 5);
     std::string mboxName          = "Test #" + std::to_string(test);
-    simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::by_name(mboxName);
+    simgrid::s4u::Mailbox* mbox   = simgrid::s4u::Mailbox::by_name(mboxName);
     void* received                = nullptr;
 
     switch (args[0][test - 1]) {
index c1c5e0a..20172e5 100644 (file)
@@ -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::by_name("mailbox");
+  simgrid::s4u::Mailbox* mailbox = simgrid::s4u::Mailbox::by_name("mailbox");
 
   simgrid::s4u::CommPtr sendComm = mailbox->put_async(new std::string("Some data"), 0);
 
@@ -28,7 +28,7 @@ static void server()
   delete res;
   sendComm->wait();
 
-  simgrid::s4u::MailboxPtr mailbox2 = simgrid::s4u::Mailbox::by_name("mailbox2");
+  simgrid::s4u::Mailbox* mailbox2 = simgrid::s4u::Mailbox::by_name("mailbox2");
   mailbox2->set_receiver(simgrid::s4u::Actor::self());
 
   mailbox2->put_init(new std::string("More data"), 0)->detach();
index 7fd0ac6..9f1099d 100644 (file)
@@ -9,7 +9,7 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_test, "Messages specific for this msg example")
 
 static void sendpid()
 {
-  simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name("mailbox");
+  simgrid::s4u::Mailbox* 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([pid](bool /*failed*/) { XBT_INFO("Process \"%d\" killed.", pid); });
@@ -23,7 +23,7 @@ static void sendpid()
 
 static void killall()
 {
-  simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name("mailbox");
+  simgrid::s4u::Mailbox* mailbox = simgrid::s4u::Mailbox::by_name("mailbox");
   for (int i = 0; i < 3; i++) {
     int* pid = static_cast<int*>(mailbox->get());
     XBT_INFO("Killing process \"%d\".", *pid);
index b3bc302..7e2e985 100644 (file)
@@ -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::by_name(remote_host);
+  simgrid::s4u::Mailbox* mailbox   = simgrid::s4u::Mailbox::by_name(remote_host);
   mailbox->put(payload, static_cast<double>(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::by_name("alice");
+  simgrid::s4u::Mailbox* 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::by_name(simgrid::s4u::this_actor::get_host()->get_cname());
+  simgrid::s4u::Mailbox* mailbox = simgrid::s4u::Mailbox::by_name(simgrid::s4u::this_actor::get_host()->get_cname());
 
   XBT_INFO("Server waiting for transfers ...");
   while (1) {