- m_process_t process = MSG_process_self();
- const char *hostname;
- simdata_task_t task_simdata = NULL;
- m_host_t local_host = NULL;
- m_host_t remote_host = NULL;
- smx_cond_t cond = NULL;
-
- CHECK_HOST();
-
- task_simdata = task->simdata;
- task_simdata->sender = process;
- task_simdata->source = MSG_process_get_host(process);
-
- xbt_assert0(task_simdata->using == 1,
- "This task is still being used somewhere else. You cannot send it now. Go fix your code!");
-
- task_simdata->comm = NULL;
-
- task_simdata->using++;
- local_host = ((simdata_process_t) process->simdata)->m_host;
-
- /* get the host name containing the mailbox */
- hostname = MSG_mailbox_get_hostname(mailbox);
-
- remote_host = MSG_get_host_by_name(hostname);
-
- if (NULL == remote_host)
- THROW1(not_found_error, 0, "Host %s not fount", hostname);
-
-
- DEBUG4
- ("Trying to send a task (%g kB) from %s to %s on the channel aliased by the alias %s",
- task->simdata->message_size / 1000, local_host->name,
- remote_host->name, MSG_mailbox_get_alias(mailbox));
-
- SIMIX_mutex_lock(remote_host->simdata->mutex);
-
- /* put the task in the mailbox */
- MSG_mailbox_put(mailbox, task);
-
- if (NULL != (cond = MSG_mailbox_get_cond(mailbox))) {
- DEBUG0("Somebody is listening. Let's wake him up!");
- SIMIX_cond_signal(cond);
+ msg_error_t ret = MSG_OK;
+ simdata_task_t t_simdata = NULL;
+ msg_process_t process = MSG_process_self();
+ simdata_process_t p_simdata = SIMIX_process_self_get_data(process);
+
+ int call_end = TRACE_msg_task_put_start(task); //must be after CHECK_HOST()
+
+ /* Prepare the task to send */
+ t_simdata = task->simdata;
+ t_simdata->sender = process;
+ t_simdata->source = ((simdata_process_t) SIMIX_process_self_get_data(process))->m_host;
+
+ if (t_simdata->isused != 0) {
+ if (msg_global->debug_multiple_use){
+ XBT_ERROR("This task is already used in there:");
+ xbt_backtrace_display(t_simdata->isused);
+ XBT_ERROR("And you try to reuse it from here:");
+ xbt_backtrace_display_current();
+ } else {
+ xbt_assert(t_simdata->isused == 0,
+ "This task is still being used somewhere else. You cannot send it now. Go fix your code! (use --cfg=msg/debug_multiple_use:on to get the backtrace of the other process)");
+ }