result->sC =
xbt_matrix_new_sub(sC, NODE_MATRIX_SIZE, NODE_MATRIX_SIZE, 0, 0, NULL);
task = MSG_task_create("result",100,100,result);
- MSG_task_dsend(task, "0", NULL);
+ MSG_task_dsend(task, "0", (void_f_pvoid_t) MSG_task_destroy);
}
/* Clean up and finish*/
* \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)
+ * communication fails, e.g. MSG_task_destroy
+ * (if NULL, no function will be called)
*/
void MSG_task_dsend(m_task_t task, const char *alias, void_f_pvoid_t cleanup)
{
CHECK_HOST();
- if (cleanup == NULL) {
- cleanup = (void_f_pvoid_t) MSG_task_destroy;
- }
-
/* FIXME: these functions are not traceable */
/* Prepare the task to send */
/* Send it by calling SIMIX network layer */
smx_action_t comm = SIMIX_req_comm_isend(mailbox, t_simdata->message_size,
- t_simdata->rate, task, sizeof(void *), NULL,cleanup, NULL, 1);
+ t_simdata->rate, task, sizeof(void *), NULL, cleanup, NULL, 1);
t_simdata->comm = comm;
}
if (action->comm.detached && action->state != SIMIX_DONE) {
/* the communication has failed and was detached:
* we have to free the buffer */
- action->comm.clean_fun(action->comm.src_buff);
+ if (action->comm.clean_fun) {
+ action->comm.clean_fun(action->comm.src_buff);
+ }
action->comm.src_buff = NULL;
}