+ SIMIX_cond_destroy(cond);\r
+ \r
+ MSG_mailbox_set_cond(mailbox,NULL);\r
+ }\r
+ \r
+ t_simdata = t->simdata;\r
+ t_simdata->receiver = process;\r
+ *task = t;\r
+ \r
+ SIMIX_mutex_lock(t_simdata->mutex);\r
+ \r
+ /* Transfer */\r
+ /* create SIMIX action to the communication */\r
+ t_simdata->comm = SIMIX_action_communicate(\r
+ t_simdata->sender->simdata->m_host->simdata->smx_host,\r
+ process->simdata->m_host->simdata->smx_host,\r
+ t->name, \r
+ t_simdata->message_size,\r
+ t_simdata->rate\r
+ );\r
+ \r
+ /* if the process is suspend, create the action but stop its execution, it will be restart when the sender process resume */\r
+ if (MSG_process_is_suspended(t_simdata->sender)) \r
+ {\r
+ DEBUG1("Process sender (%s) suspended", t_simdata->sender->name);\r
+ SIMIX_action_set_priority(t_simdata->comm, 0);\r
+ }\r
+ \r
+ process->simdata->waiting_task = t;\r
+ SIMIX_register_action_to_condition(t_simdata->comm, t_simdata->cond);\r
+ \r
+ while (1) \r
+ {\r
+ SIMIX_cond_wait(t_simdata->cond, t_simdata->mutex);\r
+ \r
+ if (SIMIX_action_get_state(t_simdata->comm) != SURF_ACTION_RUNNING)\r
+ break;\r
+ }\r
+ \r
+ SIMIX_unregister_action_to_condition(t_simdata->comm, t_simdata->cond);\r
+ process->simdata->waiting_task = NULL;\r
+ \r
+ /* the task has already finished and the pointer must be null */\r
+ if (t->simdata->sender) \r
+ {\r
+ t->simdata->sender->simdata->waiting_task = NULL;\r
+ }\r
+ \r
+ /* for this process, don't need to change in get function */\r
+ t->simdata->receiver = NULL;\r
+ SIMIX_mutex_unlock(t_simdata->mutex);\r
+ \r
+ \r
+ if (SIMIX_action_get_state(t_simdata->comm) == SURF_ACTION_DONE) \r
+ {\r
+ SIMIX_action_destroy(t_simdata->comm);\r
+ t_simdata->comm = NULL;\r
+ t_simdata->using--;\r
+ MSG_RETURN(MSG_OK);\r
+ } \r
+ else if (SIMIX_host_get_state(h_simdata->smx_host) == 0) \r
+ {\r
+ SIMIX_action_destroy(t_simdata->comm);\r
+ t_simdata->comm = NULL;\r
+ t_simdata->using--;\r
+ MSG_RETURN(MSG_HOST_FAILURE);\r