/** 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);
void (*p_cleanFunction)(void *) = NULL;
void (*p_copyDataFunction)(smx_synchro_t, void*, size_t) = NULL;
-
-
-
private:
Actor *p_sender = NULL;
+ Actor *p_receiver = NULL;
Mailbox *p_mailbox = NULL;
};
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();
+ res->p_receiver = receiver;
res->p_mailbox = &chan;
return *res;
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, -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, 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);
}