XBT_PUBLIC(smx_mailbox_t) simcall_mbox_create(const char *name);
XBT_PUBLIC(smx_mailbox_t) simcall_mbox_get_by_name(const char *name);
XBT_PUBLIC(smx_synchro_t) simcall_mbox_get_head(smx_mailbox_t mbox);
-XBT_PUBLIC(smx_process_t) simcall_mbox_get_receiver(smx_mailbox_t mbox);
XBT_PUBLIC(void) simcall_mbox_set_receiver(smx_mailbox_t mbox , smx_process_t process);
/***** Communication simcalls *****/
#include "xbt/log.h"
#include "src/msg/msg_private.h"
+#include "src/simix/smx_network_private.h"
#include "simgrid/s4u/mailbox.hpp"
void s4u::Mailbox::setReceiver(smx_process_t process) {
simcall_mbox_set_receiver(pimpl_, process);
}
+/** @brief get the receiver (process associated to the mailbox) */
smx_process_t s4u::Mailbox::receiver() {
- return simcall_mbox_get_receiver(pimpl_);
+ return pimpl_->permanent_receiver;
}
/*------- C functions -------*/
simcall_BODY_mbox_set_receiver(mbox, process);
}
-smx_process_t simcall_mbox_get_receiver(smx_mailbox_t mbox)
-{
- return simcall_BODY_mbox_get_receiver(mbox);
-}
-
/**
* \ingroup simix_comm_management
*/
simcall->args[1].dp = arg;
}
-static inline smx_mailbox_t simcall_mbox_get_receiver__get__mbox(smx_simcall_t simcall) {
- return (smx_mailbox_t) simcall->args[0].dp;
-}
-static inline void simcall_mbox_get_receiver__set__mbox(smx_simcall_t simcall, void* arg) {
- simcall->args[0].dp = arg;
-}
-static inline smx_process_t simcall_mbox_get_receiver__get__result(smx_simcall_t simcall){
- return (smx_process_t) simcall->result.dp;
-}
-static inline void simcall_mbox_get_receiver__set__result(smx_simcall_t simcall, void* result){
- simcall->result.dp = result;
-}
-
static inline smx_mailbox_t simcall_comm_iprobe__get__mbox(smx_simcall_t simcall) {
return (smx_mailbox_t) simcall->args[0].dp;
}
}
-inline static smx_process_t simcall_BODY_mbox_get_receiver(smx_mailbox_t mbox) {
- smx_process_t self = SIMIX_process_self();
-
- /* Go to that function to follow the code flow through the simcall barrier */
- if (0) SIMIX_mbox_get_receiver(mbox);
- /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
- self->simcall.call = SIMCALL_MBOX_GET_RECEIVER;
- memset(&self->simcall.result, 0, sizeof(self->simcall.result));
- memset(self->simcall.args, 0, sizeof(self->simcall.args));
- self->simcall.args[0].dp = (void*) mbox;
- if (self != simix_global->maestro_process) {
- XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
- SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
- SIMIX_process_yield(self);
- } else {
- SIMIX_simcall_handle(&self->simcall, 0);
- }
- return (smx_process_t) self->simcall.result.dp;
- }
-
inline static smx_synchro_t simcall_BODY_comm_iprobe(smx_mailbox_t mbox, int type, int src, int tag, simix_match_func_t match_fun, void* data) {
smx_process_t self = SIMIX_process_self();
SIMCALL_MBOX_CREATE,
SIMCALL_MBOX_GET_HEAD,
SIMCALL_MBOX_SET_RECEIVER,
- SIMCALL_MBOX_GET_RECEIVER,
SIMCALL_COMM_IPROBE,
SIMCALL_COMM_SEND,
SIMCALL_COMM_ISEND,
"SIMCALL_MBOX_CREATE",
"SIMCALL_MBOX_GET_HEAD",
"SIMCALL_MBOX_SET_RECEIVER",
- "SIMCALL_MBOX_GET_RECEIVER",
"SIMCALL_COMM_IPROBE",
"SIMCALL_COMM_SEND",
"SIMCALL_COMM_ISEND",
SIMIX_simcall_answer(simcall);
break;
-case SIMCALL_MBOX_GET_RECEIVER:
- simcall->result.dp = SIMIX_mbox_get_receiver((smx_mailbox_t) simcall->args[0].dp);
- SIMIX_simcall_answer(simcall);
- break;
-
case SIMCALL_COMM_IPROBE:
simcall->result.dp = simcall_HANDLER_comm_iprobe(simcall , (smx_mailbox_t) simcall->args[0].dp, simcall->args[1].i, simcall->args[2].i, simcall->args[3].i, (simix_match_func_t) simcall->args[4].fp, simcall->args[5].dp);
SIMIX_simcall_answer(simcall);
Func - mbox_create (void*, smx_mailbox_t) (name, const char*)
Func - mbox_get_head (void*, smx_synchro_t) (mbox, void*, smx_mailbox_t)
Proc - mbox_set_receiver (void) (mbox, void*, smx_mailbox_t) (receiver, void*, smx_process_t)
-Func - mbox_get_receiver (void*, smx_process_t) (mbox, void*, smx_mailbox_t)
Func H comm_iprobe (void*, smx_synchro_t) (mbox, void*, smx_mailbox_t) (type, int) (src, int) (tag, int) (match_fun, FPtr, simix_match_func_t) (data, void*)
Blck H comm_send (void) (sender, void*, smx_process_t) (mbox, void*, smx_mailbox_t) (task_size, double) (rate, double) (src_buff, void*) (src_buff_size, size_t) (match_fun, FPtr, simix_match_func_t) (copy_data_fun, FPtr, simix_copy_data_func_t) (data, void*) (timeout, double)
return mbox->comm_queue->empty()? nullptr:mbox->comm_queue->front();
}
-/**
- * \brief get the receiver (process associated to the mailbox)
- * \param mbox The rendez-vous point
- * \return process The receiving process (NULL if not set)
- */
-smx_process_t SIMIX_mbox_get_receiver(smx_mailbox_t mbox)
-{
- return mbox->permanent_receiver;
-}
-
/**
* \brief set the receiver of the rendez vous point to allow eager sends
* \param mbox The rendez-vous point
XBT_PRIVATE void SIMIX_mbox_remove(smx_mailbox_t mbox, smx_synchro_t comm);
XBT_PRIVATE smx_synchro_t SIMIX_mbox_get_head(smx_mailbox_t mbox);
XBT_PRIVATE void SIMIX_mbox_set_receiver(smx_mailbox_t mbox, smx_process_t proc);
-XBT_PRIVATE smx_process_t SIMIX_mbox_get_receiver(smx_mailbox_t mbox);
XBT_PRIVATE smx_synchro_t SIMIX_comm_irecv(smx_process_t dst_proc, smx_mailbox_t mbox,
void *dst_buff, size_t *dst_buff_size,
int (*)(void *, void *, smx_synchro_t),