Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
rename S4U::Channel to S4U::Mailbox. It was not a good idea
[simgrid.git] / src / s4u / s4u_process.cpp
index 608c748..b75cd58 100644 (file)
@@ -4,6 +4,7 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
+#include "../../include/simgrid/s4u/mailbox.hpp"
 #include "xbt/log.h"
 #include "msg/msg_private.h"
 #include "msg/msg_mailbox.h"
@@ -80,19 +81,17 @@ void s4u::Process::execute(double flops) {
        simcall_process_execute(NULL,flops,1.0/*priority*/,0./*bound*/, 0L/*affinity*/);
 }
 
-char *s4u::Process::recvstr(const char* mailbox) {
+char *s4u::Process::recvstr(Mailbox &chan) {
        char *res=NULL;
        size_t res_size=sizeof(res);
-       smx_rdv_t rdv = MSG_mailbox_get_by_alias(mailbox);
 
-       simcall_comm_recv(rdv,&res,&res_size,NULL,NULL,NULL,-1 /* timeout */,-1 /*rate*/);
+       simcall_comm_recv(chan.getInferior(),&res,&res_size,NULL,NULL,NULL,-1 /* timeout */,-1 /*rate*/);
 
     return res;
 }
-void s4u::Process::sendstr(const char* mailbox, const char*msg) {
+void s4u::Process::sendstr(Mailbox &chan, const char*msg) {
        char *msg_cpy=xbt_strdup(msg);
-       smx_rdv_t rdv = MSG_mailbox_get_by_alias(mailbox);
-       smx_synchro_t comm = simcall_comm_isend(p_smx_process, rdv, strlen(msg),
+       smx_synchro_t comm = simcall_comm_isend(p_smx_process, chan.getInferior(), strlen(msg),
                        -1/*rate*/, msg_cpy, sizeof(void *),
                        NULL, NULL, NULL,NULL/*data*/, 0);
        simcall_comm_wait(comm, -1/*timeout*/);