* @param mailbox The mailbox concerned by the operation.
* @return The task at the head of the mailbox.
*/
-XBT_PUBLIC(msg_task_t) MSG_mailbox_get_head(msg_mailbox_t mailbox);
+XBT_PUBLIC(msg_task_t) MSG_mailbox_front(msg_mailbox_t mailbox);
XBT_PUBLIC(msg_error_t) MSG_mailbox_get_task_ext(msg_mailbox_t mailbox, msg_task_t * task, msg_host_t host,
double timeout);
/* Used only by the bindings -- unclean pimple, please ignore if you're not writing a binding */
XBT_PUBLIC(smx_context_t) MSG_process_get_smx_ctx(msg_process_t process);
+
+/* Functions renamed in 3.14 */
+#define MSG_mailbox_get_head(m) MSG_mailbox_front(m)
+
+
SG_END_DECL()
#endif
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_synchro_t) simcall_mbox_front(smx_mailbox_t mbox);
XBT_PUBLIC(void) simcall_mbox_set_receiver(smx_mailbox_t mbox , smx_process_t process);
/***** Communication simcalls *****/
{
msg_task_t task;
- if (NULL == (task = MSG_mailbox_get_head(MSG_mailbox_get_by_alias(alias))))
+ if (NULL == (task = MSG_mailbox_front(MSG_mailbox_get_by_alias(alias))))
return -1;
return MSG_process_get_PID(task->simdata->sender);
int MSG_mailbox_is_empty(msg_mailbox_t mailbox)
{
- return (NULL == simcall_mbox_get_head(mailbox));
+ return (NULL == simcall_mbox_front(mailbox));
}
-msg_task_t MSG_mailbox_get_head(msg_mailbox_t mailbox)
+msg_task_t MSG_mailbox_front(msg_mailbox_t mailbox)
{
- smx_synchro_t comm = simcall_mbox_get_head(mailbox);
+ smx_synchro_t comm = simcall_mbox_front(mailbox);
if (!comm)
return NULL;
}
bool s4u::Mailbox::empty() {
- return nullptr == simcall_mbox_get_head(pimpl_);
+ return nullptr == simcall_mbox_front(pimpl_);
}
void s4u::Mailbox::setReceiver(smx_process_t process) {
* \param mbox The rendez-vous point
* \return The communication or NULL if empty
*/
-smx_synchro_t simcall_mbox_get_head(smx_mailbox_t mbox)
+smx_synchro_t simcall_mbox_front(smx_mailbox_t mbox)
{
- return simcall_BODY_mbox_get_head(mbox);
+
+ return mbox->comm_queue->empty()? nullptr:mbox->comm_queue->front();
}
void simcall_mbox_set_receiver(smx_mailbox_t mbox, smx_process_t process)
simcall->result.dp = result;
}
-static inline smx_mailbox_t simcall_mbox_get_head__get__mbox(smx_simcall_t simcall) {
- return (smx_mailbox_t) simcall->args[0].dp;
-}
-static inline void simcall_mbox_get_head__set__mbox(smx_simcall_t simcall, void* arg) {
- simcall->args[0].dp = arg;
-}
-static inline smx_synchro_t simcall_mbox_get_head__get__result(smx_simcall_t simcall){
- return (smx_synchro_t) simcall->result.dp;
-}
-static inline void simcall_mbox_get_head__set__result(smx_simcall_t simcall, void* result){
- simcall->result.dp = result;
-}
-
static inline smx_mailbox_t simcall_mbox_set_receiver__get__mbox(smx_simcall_t simcall) {
return (smx_mailbox_t) simcall->args[0].dp;
}
return (smx_mailbox_t) self->simcall.result.dp;
}
-inline static smx_synchro_t simcall_BODY_mbox_get_head(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_head(mbox);
- /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
- self->simcall.call = SIMCALL_MBOX_GET_HEAD;
- 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_synchro_t) self->simcall.result.dp;
- }
-
inline static void simcall_BODY_mbox_set_receiver(smx_mailbox_t mbox, smx_process_t receiver) {
smx_process_t self = SIMIX_process_self();
SIMCALL_PROCESS_AUTO_RESTART_SET,
SIMCALL_PROCESS_RESTART,
SIMCALL_MBOX_CREATE,
- SIMCALL_MBOX_GET_HEAD,
SIMCALL_MBOX_SET_RECEIVER,
SIMCALL_COMM_IPROBE,
SIMCALL_COMM_SEND,
"SIMCALL_PROCESS_AUTO_RESTART_SET",
"SIMCALL_PROCESS_RESTART",
"SIMCALL_MBOX_CREATE",
- "SIMCALL_MBOX_GET_HEAD",
"SIMCALL_MBOX_SET_RECEIVER",
"SIMCALL_COMM_IPROBE",
"SIMCALL_COMM_SEND",
SIMIX_simcall_answer(simcall);
break;
-case SIMCALL_MBOX_GET_HEAD:
- simcall->result.dp = SIMIX_mbox_get_head((smx_mailbox_t) simcall->args[0].dp);
- SIMIX_simcall_answer(simcall);
- break;
-
case SIMCALL_MBOX_SET_RECEIVER:
SIMIX_mbox_set_receiver((smx_mailbox_t) simcall->args[0].dp,(smx_process_t) simcall->args[1].dp);
SIMIX_simcall_answer(simcall);
Func H process_restart (void*, smx_process_t) (process, void*, smx_process_t)
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 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*)
return (smx_mailbox_t) xbt_dict_get_or_null(mailboxes, name);
}
-smx_synchro_t SIMIX_mbox_get_head(smx_mailbox_t mbox)
-{
- return mbox->comm_queue->empty()? nullptr:mbox->comm_queue->front();
-}
-
/**
* \brief set the receiver of the rendez vous point to allow eager sends
* \param mbox The rendez-vous point
XBT_PRIVATE smx_mailbox_t SIMIX_mbox_create(const char *name);
XBT_PRIVATE smx_mailbox_t SIMIX_mbox_get_by_name(const char *name);
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_synchro_t SIMIX_comm_irecv(smx_process_t dst_proc, smx_mailbox_t mbox,
void *dst_buff, size_t *dst_buff_size,