Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
no need for the sendstr() pimple. use send() instead
authorMartin Quinson <martin.quinson@loria.fr>
Sun, 16 Aug 2015 16:51:25 +0000 (18:51 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Sun, 16 Aug 2015 16:51:25 +0000 (18:51 +0200)
examples/s4u/dumb/s4u_test.cpp
include/simgrid/s4u/actor.hpp
src/s4u/s4u_actor.cpp

index 41559b6..678d16f 100644 (file)
@@ -31,8 +31,9 @@ public:
                        : Actor(procname,host,argc,argv){}
 
        int main(int argc, char **argv) {
                        : Actor(procname,host,argc,argv){}
 
        int main(int argc, char **argv) {
+               const char *msg = "GaBuZoMeu";
                XBT_INFO("Hello s4u, I have something to send");
                XBT_INFO("Hello s4u, I have something to send");
-               sendstr(*Mailbox::byName("worker"),"GaBuZoMeu");
+               send(*Mailbox::byName("worker"), xbt_strdup(msg), strlen(msg));
 
                XBT_INFO("I'm done. See you.");
                return 1;
 
                XBT_INFO("I'm done. See you.");
                return 1;
index b34a8e9..4476f5e 100644 (file)
@@ -86,8 +86,8 @@ public:
        /** Block the actor until it gets a message from the given mailbox */
        void *recv(Mailbox &chan);
 
        /** Block the actor until it gets a message from the given mailbox */
        void *recv(Mailbox &chan);
 
-       /** Block the actor until it delivers a string message (that will be copied) to the given mailbox */
-       void sendstr(Mailbox &chan, const char*msg);
+       /** Block the actor until it delivers a message of the given simulated size to the given mailbox */
+       void send(Mailbox &chan, void*payload, size_t simulatedSize);
 
        /** Creates (but don't start) an async send action */
        Comm &send_init(Mailbox &chan);
 
        /** Creates (but don't start) an async send action */
        Comm &send_init(Mailbox &chan);
index fb3fb0d..04544a0 100644 (file)
@@ -91,10 +91,10 @@ void *s4u::Actor::recv(Mailbox &chan) {
 
     return res;
 }
 
     return res;
 }
-void s4u::Actor::sendstr(Mailbox &chan, const char*msg) {
+void s4u::Actor::send(Mailbox &chan, void *payload, size_t simulatedSize) {
        Comm c = Comm::send_init(this,chan);
        Comm c = Comm::send_init(this,chan);
-       c.setRemains(strlen(msg));
-       c.setSrcData(xbt_strdup(msg),sizeof(char*));
+       c.setRemains(simulatedSize);
+       c.setSrcData(payload);
        c.wait();
 }
 
        c.wait();
 }