Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add debug informations.
[simgrid.git] / src / msg / gos.c
index 6ad4005acc02013d11b0fcf3f884c59e1230bef0..b0a60c6fd3839098672984820c4f6ddba96db7f9 100644 (file)
@@ -405,6 +405,7 @@ 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);
 }
@@ -466,6 +467,7 @@ 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);
 }
+
 int MSG_comm_test(msg_comm_t comm) {
        return SIMIX_network_test(comm);
 }
@@ -514,6 +516,32 @@ MSG_error_t MSG_comm_wait(msg_comm_t comm, double timeout) {
        return res;
 }
 
+
+/* This function is called by a sender and permit to wait for each communication
+ *
+ * Param:
+ * - msg_comm_t *comm a vector of communication
+ * - int nb_elem is th esize of the comm vector
+ * - 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<nb_elem; i++)
+       {
+               MSG_comm_wait(comm[i],timeout);
+       }
+}
+
+int MSG_comm_waitany(xbt_dynar_t comms) {
+       return SIMIX_network_waitany(comms);
+}
+
+m_task_t MSG_comm_get_task(msg_comm_t comm) {
+       xbt_assert0(comm, "Invalid parameters");
+       return (m_task_t) SIMIX_communication_get_src_buf(comm);
+}
+
 /** \ingroup msg_gos_functions
  * \brief Put a task on a channel of an host and waits for the end of the
  * transmission.
@@ -603,6 +631,7 @@ MSG_task_put_with_timeout(m_task_t task, m_host_t dest, m_channel_t channel,
 
 MSG_error_t MSG_task_send(m_task_t task, const char *alias)
 {
+       DEBUG1("MSG_task_send: Trying to send a message on mailbox '%s'",alias);
        return MSG_task_send_with_timeout(task, alias, -1);
 }