/** * \ingroup simix_comm_management */ void simcall_comm_recv(smx_rdv_t rdv, void *dst_buff, size_t * dst_buff_size, int (*match_fun)(void *, void *, smx_action_t), void *data, double timeout) { xbt_assert(isfinite(timeout), "timeout is not finite!"); xbt_assert(rdv, "No rendez-vous point defined for recv"); if (MC_is_active()) { /* the model-checker wants two separate simcalls */ smx_action_t comm = simcall_comm_irecv(rdv, dst_buff, dst_buff_size, match_fun, data); simcall_comm_wait(comm, timeout); } else { simcall_BODY_comm_recv(rdv, dst_buff, dst_buff_size, match_fun, data, timeout); } }
/** \ingroup msg_task_usage * \brief Starts listening for receiving a task from an asynchronous communication at a given rate. * * \param task a memory location for storing a #msg_task_t. has to be valid until the end of the communication. * \param name of the mailbox to receive the task on * \param rate limit the bandwidth to the given rate * \return the msg_comm_t communication created */ msg_comm_t MSG_task_irecv_bounded(msg_task_t *task, const char *name, double rate) { smx_mailbox_t rdv = MSG_mailbox_get_by_alias(name); /* FIXME: these functions are not traceable */ /* Sanity check */ xbt_assert(task, "Null pointer for the task storage"); if (*task) XBT_CRITICAL("MSG_task_irecv() was asked to write in a non empty task struct."); /* Try to receive it by calling SIMIX network layer */ msg_comm_t comm = xbt_new0(s_msg_comm_t, 1); comm->task_sent = nullptr; comm->task_received = task; comm->status = MSG_OK; comm->s_comm = simcall_comm_irecv(MSG_process_self(), rdv, task, nullptr, nullptr, nullptr, nullptr, rate); return comm; }
/** * \ingroup simix_comm_management */ void simcall_comm_recv(smx_process_t receiver, smx_mailbox_t mbox, void *dst_buff, size_t * dst_buff_size, int (*match_fun)(void *, void *, smx_synchro_t), void (*copy_data_fun)(smx_synchro_t, void*, size_t), void *data, double timeout, double rate) { xbt_assert(std::isfinite(timeout), "timeout is not finite!"); xbt_assert(mbox, "No rendez-vous point defined for recv"); if (MC_is_active() || MC_record_replay_is_active()) { /* the model-checker wants two separate simcalls */ smx_synchro_t comm = NULL; /* MC needs the comm to be set to NULL during the simcall */ comm = simcall_comm_irecv(receiver, mbox, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, rate); simcall_comm_wait(comm, timeout); comm = NULL; } else { simcall_BODY_comm_recv(receiver, mbox, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, timeout, rate); } }