"This task is executed somewhere else. Go fix your code! %d",
task->simdata->isused);
- DEBUG1("Computing on %s", MSG_process_self()->simdata->m_host->name);
+ XBT_DEBUG("Computing on %s", MSG_process_self()->simdata->m_host->name);
if (simdata->computation_amount == 0) {
#ifdef HAVE_TRACING
simdata->isused=0;
- DEBUG2("Execution task '%s' finished in state %d", task->name, comp_state);
+ XBT_DEBUG("Execution task '%s' finished in state %d", task->name, comp_state);
if (comp_state == SIMIX_DONE) {
/* action ended, set comm and compute = NULL, the actions is already destroyed in the main function */
simdata->computation_amount = 0.0;
xbt_assert0(simdata->host_nb,
"This is not a parallel task. Go to hell.");
- DEBUG1("Parallel computing on %s", MSG_process_self()->simdata->m_host->name);
+ XBT_DEBUG("Parallel computing on %s", MSG_process_self()->simdata->m_host->name);
simdata->isused=1;
simdata->host_list,
simdata->comp_amount,
simdata->comm_amount, 1.0, -1.0);
- DEBUG1("Parallel execution action created: %p", simdata->compute);
+ XBT_DEBUG("Parallel execution action created: %p", simdata->compute);
self->simdata->waiting_action = simdata->compute;
comp_state = SIMIX_req_host_execution_wait(simdata->compute);
self->simdata->waiting_action = NULL;
- DEBUG2("Finished waiting for execution of action %p, state = %d", simdata->compute, comp_state);
+ XBT_DEBUG("Finished waiting for execution of action %p, state = %d", simdata->compute, comp_state);
simdata->isused=0;
proc->simdata->waiting_action = NULL;*/
if (state == SIMIX_DONE) {
- if (SIMIX_req_host_get_state(SIMIX_host_self()) == SURF_RESOURCE_OFF) {
#ifdef HAVE_TRACING
- TRACE_msg_process_sleep_out(MSG_process_self());
+ TRACE_msg_process_sleep_out(MSG_process_self());
#endif
- MSG_RETURN(MSG_HOST_FAILURE);
- }
+ MSG_RETURN(MSG_OK);
} else {
#ifdef HAVE_TRACING
TRACE_msg_process_sleep_out(MSG_process_self());
#endif
MSG_RETURN(MSG_HOST_FAILURE);
}
-#ifdef HAVE_TRACING
- TRACE_msg_process_sleep_out(MSG_process_self());
-#endif
- MSG_RETURN(MSG_OK);
}
/** \ingroup msg_gos_functions
MSG_task_receive_ext(m_task_t * task, const char *alias, double timeout,
m_host_t host)
{
- DEBUG1
+ XBT_DEBUG
("MSG_task_receive_ext: Trying to receive a message on mailbox '%s'",
alias);
return MSG_mailbox_get_task_ext(MSG_mailbox_get_by_alias(alias), task,
comm->status = MSG_OK;
comm->s_comm =
SIMIX_req_comm_isend(mailbox, t_simdata->message_size,
- t_simdata->rate, task, sizeof(void *), NULL, NULL);
+ t_simdata->rate, task, sizeof(void *), NULL, NULL, 0);
t_simdata->comm = comm->s_comm; /* FIXME: is the field t_simdata->comm still useful? */
return comm;
}
+/** \ingroup msg_gos_functions
+ * \brief Sends a task on a mailbox.
+ *
+ * This is a non blocking detached send function.
+ * Think of it as a best effort send. The communication
+ * object will be destroyed by the receiver (if any).
+ *
+ * \param task a #m_task_t to send on another location.
+ * \param alias name of the mailbox to sent the task to
+ * \param cleanup a function to destroy the task if the
+ * communication fails (if NULL, MSG_task_destroy() will
+ * be used by default)
+ */
+void MSG_task_dsend(m_task_t task, const char *alias, void_f_pvoid_t cleanup)
+{
+ simdata_task_t t_simdata = NULL;
+ m_process_t process = MSG_process_self();
+ msg_mailbox_t mailbox = MSG_mailbox_get_by_alias(alias);
+
+ CHECK_HOST();
+
+ if (cleanup == NULL) {
+ cleanup = (void_f_pvoid_t) MSG_task_destroy;
+ }
+
+ /* FIXME: these functions are not traceable */
+
+ /* Prepare the task to send */
+ t_simdata = task->simdata;
+ t_simdata->sender = process;
+ t_simdata->source = MSG_host_self();
+
+ xbt_assert0(t_simdata->isused == 0,
+ "This task is still being used somewhere else. You cannot send it now. Go fix your code!");
+
+ t_simdata->isused = 1;
+ msg_global->sent_msg++;
+
+ /* Send it by calling SIMIX network layer */
+ SIMIX_req_comm_isend(mailbox, t_simdata->message_size,
+ t_simdata->rate, task, sizeof(void *), NULL, cleanup, 1);
+}
+
/** \ingroup msg_gos_functions
* \brief Starts listening for receiving a task from an asynchronous communication.
*
xbt_assert0(task, "Null pointer for the task storage");
if (*task)
- CRITICAL0
+ XBT_CRITICAL
("MSG_task_get() was asked to write in a non empty task struct.");
/* Try to receive it by calling SIMIX network layer */
}
/* FIXME auto-destroy comms from SIMIX to avoid this request */
- SIMIX_req_comm_destroy(comm->s_comm);
+ /*SIMIX_req_comm_destroy(comm->s_comm);*/
free(comm);
}
&& (channel < msg_global->max_channel), "Invalid channel %d",
channel);
- DEBUG1("MSG_task_put_with_timout: Trying to send a task to '%s'", dest->name);
+ XBT_DEBUG("MSG_task_put_with_timout: Trying to send a task to '%s'", dest->name);
return
MSG_mailbox_put_with_timeout(MSG_mailbox_get_by_channel
(dest, channel), task, timeout);
MSG_error_t MSG_task_send(m_task_t task, const char *alias)
{
- DEBUG1("MSG_task_send: Trying to send a message on mailbox '%s'", alias);
+ XBT_DEBUG("MSG_task_send: Trying to send a message on mailbox '%s'", alias);
return MSG_task_send_with_timeout(task, alias, -1);
}