X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/ae11ab3b4a647d982dc92a2c7dd10fb3cb853916..fda00496f6a31c2f09ed65b91d6052c2e50686df:/src/msg/gos.c diff --git a/src/msg/gos.c b/src/msg/gos.c index 6ad4005acc..d9f7c02287 100644 --- a/src/msg/gos.c +++ b/src/msg/gos.c @@ -405,10 +405,21 @@ MSG_task_receive_with_timeout(m_task_t * task, const char *alias, MSG_task_receive_ext(m_task_t * task, const char *alias, double timeout, m_host_t host) { + DEBUG1("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, host, timeout); } +/** \ingroup msg_gos_functions + * \brief Send a task on a channel. + * + * This function takes two parameter. + * \param task a #m_task_t to send on another location. + * \param alias the channel on which the agent should put this + task. This value has to be >=0 and < than the maximal number of + channels fixed with MSG_set_channel_number(). + * \return the msg_comm_t communication. + */ msg_comm_t MSG_task_isend(m_task_t task, const char *alias) { simdata_task_t t_simdata = NULL; m_process_t process = MSG_process_self(); @@ -440,6 +451,16 @@ msg_comm_t MSG_task_isend(m_task_t task, const char *alias) { task, sizeof(void*), &t_simdata->comm); } +/** \ingroup msg_gos_functions + * \brief Listen on a channel for receiving a task from an asynchronous communication. + * + * It takes two parameters. + * \param task a memory location for storing a #m_task_t. + * \param alias the channel on which the agent should be + listening. This value has to be >=0 and < than the maximal + number of channels fixed with MSG_set_channel_number(). + * \return the msg_comm_t communication. + */ msg_comm_t MSG_task_irecv(m_task_t * task, const char *alias) { smx_comm_t comm; smx_rdv_t rdv = MSG_mailbox_get_by_alias(alias)->rdv; @@ -466,11 +487,25 @@ msg_comm_t MSG_task_irecv(m_task_t * task, const char *alias) { /* Try to receive it by calling SIMIX network layer */ return SIMIX_network_irecv(rdv, task, &size); } +/** \ingroup msg_gos_functions + * \brief Test the status of a communication. + * + * It takes one parameter. + * \param comm the communication to test. + * \return the status of the communication: + * TRUE : the communication is completed + * FALSE: the communication is incompleted + * If the status is FALSE, don't forget to use MSG_process_sleep() after the test. + */ int MSG_comm_test(msg_comm_t comm) { return SIMIX_network_test(comm); } - -/* After received TRUE to MSG_comm_test() function we have to destroy the communication */ +/** \ingroup msg_gos_functions + * \brief After received TRUE to MSG_comm_test(), the communication must be destroyed. + * + * It takes one parameter. + * \param comm the communication to destroy. + */ void MSG_comm_destroy(msg_comm_t comm) { if(!(comm->src_proc == SIMIX_process_self())) { @@ -481,6 +516,14 @@ void MSG_comm_destroy(msg_comm_t comm) { SIMIX_communication_destroy(comm); } +/** \ingroup msg_gos_functions + * \brief Wait for the completion of a communication. + * + * It takes two parameters. + * \param comm the communication to wait. + * \param timeout Wait until the communication terminates or the timeout occurs + * \return MSG_error_t + */ MSG_error_t MSG_comm_wait(msg_comm_t comm, double timeout) { xbt_ex_t e; MSG_error_t res = MSG_OK; @@ -514,6 +557,37 @@ MSG_error_t MSG_comm_wait(msg_comm_t comm, double timeout) { return res; } +/** \ingroup msg_gos_functions +* \brief This function is called by a sender and permit to wait for each communication +* +* It takes three parameters. +* \param comm a vector of communication +* \param nb_elem is the size of the comm vector +* \param timeout for each call of MSG_comm_wait +*/ +void MSG_comm_waitall(msg_comm_t *comm,int nb_elem, double timeout) { + int i=0; + for(i=0; i