Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
implement s4u::Comm::recv_async()
authorMartin Quinson <martin.quinson@loria.fr>
Mon, 17 Aug 2015 16:25:40 +0000 (18:25 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Mon, 17 Aug 2015 16:25:40 +0000 (18:25 +0200)
include/simgrid/s4u/comm.hpp
src/s4u/s4u_actor.cpp
src/s4u/s4u_comm.cpp

index bf0f7cb..94b74cb 100644 (file)
@@ -32,7 +32,7 @@ public:
     /** Creates (but don't start) an async recv onto the mailbox #from */
        static Comm &recv_init(s4u::Actor *receiver, Mailbox &from);
        /** Creates and start an async recv to the mailbox #from */
-       //static Comm &recv_async(Mailbox &from, void *data);
+       static Comm &recv_async(s4u::Actor *receiver, Mailbox &from, void **data);
 
        void start() override;
        void wait() override;
index 8a5dd1c..7d3be59 100644 (file)
@@ -102,6 +102,7 @@ void s4u::Actor::send(Mailbox &chan, void *payload, size_t simulatedSize) {
        Comm c = Comm::send_init(this,chan);
        c.setRemains(simulatedSize);
        c.setSrcData(payload);
+       // c.start() is optional.
        c.wait();
 }
 
index e24b4ec..02f5e98 100644 (file)
@@ -141,3 +141,12 @@ s4u::Comm &s4u::Comm::send_async(s4u::Actor *sender, Mailbox &dest, void *data,
        return res;
 }
 
+s4u::Comm &s4u::Comm::recv_async(s4u::Actor *receiver, Mailbox &dest, void **data) {
+       s4u::Comm &res = s4u::Comm::recv_init(receiver, dest);
+
+       res.setDstData(data);
+
+       res.start();
+       return res;
+}
+