Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
there is no need for a recvstr() pimple. recv() works
authorMartin Quinson <martin.quinson@loria.fr>
Sun, 16 Aug 2015 16:42:59 +0000 (18:42 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Sun, 16 Aug 2015 16:42:59 +0000 (18:42 +0200)
examples/s4u/dumb/s4u_test.cpp
include/simgrid/s4u/actor.hpp
src/s4u/s4u_actor.cpp

index 6087684..41559b6 100644 (file)
@@ -18,7 +18,7 @@ public:
        int main(int argc, char **argv) {
                XBT_INFO("Hello s4u, I'm ready to serve");
 
        int main(int argc, char **argv) {
                XBT_INFO("Hello s4u, I'm ready to serve");
 
-               char *msg = recvstr(*Mailbox::byName("worker"));
+               char *msg = (char*)recv(*Mailbox::byName("worker"));
                XBT_INFO("I received '%s'",msg);
                XBT_INFO("I'm done. See you.");
                return 1;
                XBT_INFO("I received '%s'",msg);
                XBT_INFO("I'm done. See you.");
                return 1;
index 5e4bfba..b34a8e9 100644 (file)
@@ -84,10 +84,7 @@ public:
        void execute(double flop);
 
        /** Block the actor until it gets a message from the given mailbox */
        void execute(double flop);
 
        /** Block the actor until it gets a message from the given mailbox */
-       //void* recv(const char *mailbox);
-
-       /** Block the actor until it gets a string message (to be freed after use) from the given mailbox */
-       char *recvstr(Mailbox &chan);
+       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 string message (that will be copied) to the given mailbox */
        void sendstr(Mailbox &chan, const char*msg);
index 879d21e..fb3fb0d 100644 (file)
@@ -82,14 +82,14 @@ void s4u::Actor::execute(double flops) {
        simcall_process_execute(NULL,flops,1.0/*priority*/,0./*bound*/, 0L/*affinity*/);
 }
 
        simcall_process_execute(NULL,flops,1.0/*priority*/,0./*bound*/, 0L/*affinity*/);
 }
 
-char *s4u::Actor::recvstr(Mailbox &chan) {
+void *s4u::Actor::recv(Mailbox &chan) {
        void *res=NULL;
 
        Comm c = Comm::recv_init(this, chan);
        c.setDstData(&res,sizeof(res));
        c.wait();
 
        void *res=NULL;
 
        Comm c = Comm::recv_init(this, chan);
        c.setDstData(&res,sizeof(res));
        c.wait();
 
-    return (char*)res;
+    return res;
 }
 void s4u::Actor::sendstr(Mailbox &chan, const char*msg) {
        Comm c = Comm::send_init(this,chan);
 }
 void s4u::Actor::sendstr(Mailbox &chan, const char*msg) {
        Comm c = Comm::send_init(this,chan);