X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/a1ba88402bfb88a278d2e7c849441a9ed4a26120..00e8231fa94528961cddaa1fe35e232de5438e76:/src/msg/gos.c diff --git a/src/msg/gos.c b/src/msg/gos.c index 4993ae0de7..4c4480e2ee 100644 --- a/src/msg/gos.c +++ b/src/msg/gos.c @@ -243,22 +243,16 @@ MSG_error_t MSG_process_sleep(double nb_sec) 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 @@ -413,12 +407,48 @@ msg_comm_t MSG_task_isend(m_task_t task, const char *alias) 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 + */ +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(); + + /* 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. *