/***** Rendez-vous points *****/
XBT_PUBLIC(smx_mailbox_t) simcall_mbox_create(const char *name);
-XBT_PUBLIC(void) simcall_mbox_destroy(smx_mailbox_t mbox);
XBT_PUBLIC(smx_mailbox_t) simcall_mbox_get_by_name(const char *name);
XBT_PUBLIC(int) simcall_mbox_comm_count_by_host(smx_mailbox_t mbox, sg_host_t host);
XBT_PUBLIC(smx_synchro_t) simcall_mbox_get_head(smx_mailbox_t mbox);
return simcall_mbox_create(alias);
}
-void MSG_mailbox_free(void *mailbox)
-{
- simcall_mbox_destroy((msg_mailbox_t)mailbox);
-}
-
int MSG_mailbox_is_empty(msg_mailbox_t mailbox)
{
return (NULL == simcall_mbox_get_head(mailbox));
XBT_PRIVATE void MSG_host_add_task(msg_host_t host, msg_task_t task);
XBT_PRIVATE void MSG_host_del_task(msg_host_t host, msg_task_t task);
-/* @brief MSG_mailbox_free - release a mailbox from the memory.
- * Releases a mailbox from the memory but does not remove it from the dictionary.
- * @param mailbox The mailbox to release.
- */
-XBT_PRIVATE void MSG_mailbox_free(void *mailbox);
/********** Tracing **********/
/* declaration of instrumentation functions from msg_task_instr.c */
return simcall_BODY_mbox_create(name);
}
-
-/**
- * \ingroup simix_mbox_management
- * \brief Destroy a rendez-vous point
- * \param mbox The rendez-vous point to destroy
- */
-void simcall_mbox_destroy(smx_mailbox_t mbox)
-{
- simcall_BODY_mbox_destroy(mbox);
-}
/**
* \ingroup simix_mbox_management
* \brief Returns a rendez-vous point knowing its name
simcall->result.dp = result;
}
-static inline smx_mailbox_t simcall_mbox_destroy__get__mbox(smx_simcall_t simcall) {
- return (smx_mailbox_t) simcall->args[0].dp;
-}
-static inline void simcall_mbox_destroy__set__mbox(smx_simcall_t simcall, void* arg) {
- simcall->args[0].dp = arg;
-}
-
static inline smx_mailbox_t simcall_mbox_comm_count_by_host__get__mbox(smx_simcall_t simcall) {
return (smx_mailbox_t) simcall->args[0].dp;
}
return (smx_mailbox_t) self->simcall.result.dp;
}
-inline static void simcall_BODY_mbox_destroy(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_destroy(mbox);
- /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
- self->simcall.call = SIMCALL_MBOX_DESTROY;
- 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);
- }
-
- }
-
inline static unsigned int simcall_BODY_mbox_comm_count_by_host(smx_mailbox_t mbox, sg_host_t host) {
smx_process_t self = SIMIX_process_self();
SIMCALL_PROCESS_AUTO_RESTART_SET,
SIMCALL_PROCESS_RESTART,
SIMCALL_MBOX_CREATE,
- SIMCALL_MBOX_DESTROY,
SIMCALL_MBOX_COMM_COUNT_BY_HOST,
SIMCALL_MBOX_GET_HEAD,
SIMCALL_MBOX_SET_RECEIVER,
"SIMCALL_PROCESS_AUTO_RESTART_SET",
"SIMCALL_PROCESS_RESTART",
"SIMCALL_MBOX_CREATE",
- "SIMCALL_MBOX_DESTROY",
"SIMCALL_MBOX_COMM_COUNT_BY_HOST",
"SIMCALL_MBOX_GET_HEAD",
"SIMCALL_MBOX_SET_RECEIVER",
SIMIX_simcall_answer(simcall);
break;
-case SIMCALL_MBOX_DESTROY:
- SIMIX_mbox_destroy((smx_mailbox_t) simcall->args[0].dp);
- SIMIX_simcall_answer(simcall);
- break;
-
case SIMCALL_MBOX_COMM_COUNT_BY_HOST:
simcall->result.ui = SIMIX_mbox_comm_count_by_host((smx_mailbox_t) simcall->args[0].dp,(sg_host_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*)
-Proc - mbox_destroy (void) (mbox, void*, smx_mailbox_t)
Func - mbox_comm_count_by_host (unsigned int) (mbox, void*, smx_mailbox_t) (host, void*, sg_host_t)
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)
smx_mailbox_t SIMIX_mbox_create(const char *name)
{
+ xbt_assert(name, "Mailboxes must have a name");
/* two processes may have pushed the same mbox_create simcall at the same time */
- smx_mailbox_t mbox = name ? (smx_mailbox_t) xbt_dict_get_or_null(mailboxes, name) : NULL;
+ smx_mailbox_t mbox = (smx_mailbox_t) xbt_dict_get_or_null(mailboxes, name);
if (!mbox) {
mbox = xbt_new0(s_smx_mailbox_t, 1);
- mbox->name = name ? xbt_strdup(name) : NULL;
+ mbox->name = xbt_strdup(name);
mbox->comm_fifo = xbt_fifo_new();
mbox->done_comm_fifo = xbt_fifo_new();
mbox->permanent_receiver=NULL;
XBT_DEBUG("Creating a mailbox at %p with name %s", mbox, name);
-
- if (mbox->name)
- xbt_dict_set(mailboxes, mbox->name, mbox, NULL);
+ xbt_dict_set(mailboxes, mbox->name, mbox, NULL);
}
return mbox;
}
-void SIMIX_mbox_destroy(smx_mailbox_t mbox)
-{
- if (mbox->name)
- xbt_dict_remove(mailboxes, mbox->name);
-}
-
void SIMIX_mbox_free(void *data)
{
XBT_DEBUG("mbox free %p", data);
XBT_PRIVATE void SIMIX_mailbox_exit(void);
XBT_PRIVATE smx_mailbox_t SIMIX_mbox_create(const char *name);
-XBT_PRIVATE void SIMIX_mbox_destroy(smx_mailbox_t mbox);
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 int SIMIX_mbox_comm_count_by_host(smx_mailbox_t mbox, sg_host_t host);
smpi_comm_destroy(process_data[i]->comm_intra);
}
xbt_os_timer_free(process_data[i]->timer);
- simcall_mbox_destroy(process_data[i]->mailbox);
- simcall_mbox_destroy(process_data[i]->mailbox_small);
xbt_mutex_destroy(process_data[i]->mailboxes_mutex);
xbt_free(process_data[i]);
}