From: Martin Quinson Date: Sun, 16 Aug 2015 16:42:59 +0000 (+0200) Subject: there is no need for a recvstr() pimple. recv() works X-Git-Tag: v3_13~1690^2~13 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/30cfe4a29c017ea6c8f05873dbeeb66a535cb152 there is no need for a recvstr() pimple. recv() works --- diff --git a/examples/s4u/dumb/s4u_test.cpp b/examples/s4u/dumb/s4u_test.cpp index 6087684e1e..41559b6488 100644 --- a/examples/s4u/dumb/s4u_test.cpp +++ b/examples/s4u/dumb/s4u_test.cpp @@ -18,7 +18,7 @@ public: 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; diff --git a/include/simgrid/s4u/actor.hpp b/include/simgrid/s4u/actor.hpp index 5e4bfba745..b34a8e9bce 100644 --- a/include/simgrid/s4u/actor.hpp +++ b/include/simgrid/s4u/actor.hpp @@ -84,10 +84,7 @@ public: 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); diff --git a/src/s4u/s4u_actor.cpp b/src/s4u/s4u_actor.cpp index 879d21e530..fb3fb0dfda 100644 --- a/src/s4u/s4u_actor.cpp +++ b/src/s4u/s4u_actor.cpp @@ -82,14 +82,14 @@ void s4u::Actor::execute(double flops) { 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(); - return (char*)res; + return res; } void s4u::Actor::sendstr(Mailbox &chan, const char*msg) { Comm c = Comm::send_init(this,chan);