Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Check for errors from MSG_task_receive.
[simgrid.git] / examples / msg / pmm / msg_pmm.c
index 7b95d9c..eda3b83 100644 (file)
@@ -47,7 +47,7 @@ typedef struct s_node_job{
   xbt_matrix_t B;
 } s_node_job_t, *node_job_t;
 
-/**
+/*
  * Structure for recovering results
  */
 typedef struct s_result {
@@ -205,8 +205,11 @@ static node_job_t wait_job(int selfid)
   msg_task_t task = NULL;
   char self_mbox[MAILBOX_NAME_SIZE];
   node_job_t job;
+  msg_error_t err;
   snprintf(self_mbox, MAILBOX_NAME_SIZE - 1, "%d", selfid);
-  MSG_task_receive(&task, self_mbox);
+  err = MSG_task_receive(&task, self_mbox);
+  if (err != MSG_OK)
+    xbt_die("Error while receiving from %s (%d)", self_mbox, (int)err);
   job = (node_job_t)MSG_task_get_data(task);
   MSG_task_destroy(task);
   XBT_VERB("Got Job (%d,%d)", job->row, job->col);
@@ -235,11 +238,14 @@ static void get_sub_matrix(xbt_matrix_t *sM, int selfid)
 {
   msg_task_t task = NULL;
   char node_mbox[MAILBOX_NAME_SIZE];
+  msg_error_t err;
 
   XBT_VERB("Get sub-matrix");
 
   snprintf(node_mbox, MAILBOX_NAME_SIZE - 1, "%d", selfid);
-  MSG_task_receive(&task, node_mbox);
+  err = MSG_task_receive(&task, node_mbox);
+  if (err != MSG_OK)
+    xbt_die("Error while receiving from %s (%d)", node_mbox, (int)err);
   *sM = (xbt_matrix_t)MSG_task_get_data(task);
   MSG_task_destroy(task);
 }
@@ -274,14 +280,12 @@ int main(int argc, char *argv[])
 #ifdef BENCH_THIS_CODE
   xbt_os_timer_start(timer);
 #endif
-  MSG_error_t res = MSG_main();
+  msg_error_t res = MSG_main();
 #ifdef BENCH_THIS_CODE
   xbt_os_timer_stop(timer);
 #endif
   XBT_CRITICAL("Simulated time: %g", MSG_get_clock());
 
-  MSG_clean();
-
   if (res == MSG_OK)
     return 0;
   else