Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
adapt to the new simcall_comm_recv() prototype
authorMartin Quinson <martin.quinson@loria.fr>
Sun, 16 Aug 2015 16:38:47 +0000 (18:38 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Sun, 16 Aug 2015 16:38:47 +0000 (18:38 +0200)
include/simgrid/s4u/comm.hpp
src/s4u/s4u_actor.cpp
src/s4u/s4u_comm.cpp

index c2d3a59..bf0f7cb 100644 (file)
@@ -30,7 +30,7 @@ public:
        /** Creates and start an async send to the mailbox #dest */
        static Comm &send_async(s4u::Actor *sender, Mailbox &dest, void *data, int simulatedByteAmount);
     /** Creates (but don't start) an async recv onto the mailbox #from */
        /** Creates and start an async send to the mailbox #dest */
        static Comm &send_async(s4u::Actor *sender, Mailbox &dest, void *data, int simulatedByteAmount);
     /** Creates (but don't start) an async recv onto the mailbox #from */
-       static Comm &recv_init(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);
 
        /** Creates and start an async recv to the mailbox #from */
        //static Comm &recv_async(Mailbox &from, void *data);
 
@@ -71,11 +71,9 @@ private: /* FIXME: expose these elements in the API */
     void (*p_cleanFunction)(void *) = NULL;
     void (*p_copyDataFunction)(smx_synchro_t, void*, size_t) = NULL;
 
     void (*p_cleanFunction)(void *) = NULL;
     void (*p_copyDataFunction)(smx_synchro_t, void*, size_t) = NULL;
 
-
-
-
 private:
        Actor *p_sender = NULL;
 private:
        Actor *p_sender = NULL;
+       Actor *p_receiver = NULL;
        Mailbox *p_mailbox = NULL;
 };
 
        Mailbox *p_mailbox = NULL;
 };
 
index 74264b5..879d21e 100644 (file)
@@ -85,7 +85,7 @@ void s4u::Actor::execute(double flops) {
 char *s4u::Actor::recvstr(Mailbox &chan) {
        void *res=NULL;
 
 char *s4u::Actor::recvstr(Mailbox &chan) {
        void *res=NULL;
 
-       Comm c = Comm::recv_init(chan);
+       Comm c = Comm::recv_init(this, chan);
        c.setDstData(&res,sizeof(res));
        c.wait();
 
        c.setDstData(&res,sizeof(res));
        c.wait();
 
index 44f526e..e24b4ec 100644 (file)
@@ -24,8 +24,9 @@ s4u::Comm &s4u::Comm::send_init(s4u::Actor *sender, s4u::Mailbox &chan) {
 
        return *res;
 }
 
        return *res;
 }
-s4u::Comm &s4u::Comm::recv_init(s4u::Mailbox &chan) {
+s4u::Comm &s4u::Comm::recv_init(s4u::Actor *receiver, s4u::Mailbox &chan) {
        s4u::Comm *res = new s4u::Comm();
        s4u::Comm *res = new s4u::Comm();
+       res->p_receiver = receiver;
        res->p_mailbox = &chan;
 
        return *res;
        res->p_mailbox = &chan;
 
        return *res;
@@ -78,7 +79,7 @@ void s4u::Comm::start() {
                                p_matchFunction, p_cleanFunction, p_copyDataFunction,
                                p_userData, p_detached);
        } else if (p_dstBuff != NULL) { // Receiver side
                                p_matchFunction, p_cleanFunction, p_copyDataFunction,
                                p_userData, p_detached);
        } else if (p_dstBuff != NULL) { // Receiver side
-               p_inferior = simcall_comm_irecv(p_mailbox->getInferior(), p_dstBuff, &p_dstBuffSize,
+               p_inferior = simcall_comm_irecv(p_receiver->getInferior(), p_mailbox->getInferior(), p_dstBuff, &p_dstBuffSize,
                                p_matchFunction, p_copyDataFunction,
                                p_userData, p_rate);
 
                                p_matchFunction, p_copyDataFunction,
                                p_userData, p_rate);
 
@@ -99,7 +100,7 @@ void s4u::Comm::wait() {
                                        p_matchFunction, p_copyDataFunction,
                                        p_userData, -1 /*timeout*/);
                } else {
                                        p_matchFunction, p_copyDataFunction,
                                        p_userData, -1 /*timeout*/);
                } else {
-                       simcall_comm_recv(p_mailbox->getInferior(), p_dstBuff, &p_dstBuffSize,
+                       simcall_comm_recv(p_receiver->getInferior(), p_mailbox->getInferior(), p_dstBuff, &p_dstBuffSize,
                                        p_matchFunction, p_copyDataFunction,
                                        p_userData, -1/*timeout*/, p_rate);
                }
                                        p_matchFunction, p_copyDataFunction,
                                        p_userData, -1/*timeout*/, p_rate);
                }
@@ -122,7 +123,7 @@ void s4u::Comm::wait(double timeout) {
                                p_matchFunction, p_copyDataFunction,
                                p_userData, timeout);
        } else { // Receiver
                                p_matchFunction, p_copyDataFunction,
                                p_userData, timeout);
        } else { // Receiver
-               simcall_comm_recv(p_mailbox->getInferior(), p_dstBuff, &p_dstBuffSize,
+               simcall_comm_recv(p_receiver->getInferior(), p_mailbox->getInferior(), p_dstBuff, &p_dstBuffSize,
                                p_matchFunction, p_copyDataFunction,
                                p_userData, timeout, p_rate);
        }
                                p_matchFunction, p_copyDataFunction,
                                p_userData, timeout, p_rate);
        }