Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
model-checker : add comments for the example bugged2_liveness
[simgrid.git] / examples / msg / icomms / peer3.c
index a139864..410e0f7 100644 (file)
@@ -49,7 +49,7 @@ int sender(int argc, char *argv[])
                         task_comm_size / coef, NULL);
     comm = MSG_task_isend(task, mailbox);
     xbt_dynar_push_as(d, msg_comm_t, comm);
-    INFO3("Send to receiver-%ld %s comm_size %f", i % receivers_count,
+    XBT_INFO("Send to receiver-%ld %s comm_size %f", i % receivers_count,
           sprintf_buffer, task_comm_size / coef);
   }
   /* Here we are waiting for the completion of all communications */
@@ -64,16 +64,17 @@ int sender(int argc, char *argv[])
   sprintf(mailbox, "finalize");
 
   msg_comm_t res_irecv;
+  _XBT_GNUC_UNUSED MSG_error_t res_wait;
   for (i = 0; i < receivers_count; i++) {
     task = NULL;
     res_irecv = MSG_task_irecv(&(task), mailbox);
-    xbt_assert0(MSG_comm_wait(res_irecv, -1) == MSG_OK,
-                "MSG_comm_wait failed");
+    res_wait = MSG_comm_wait(res_irecv, -1);
+    xbt_assert(res_wait == MSG_OK, "MSG_comm_wait failed");
     MSG_comm_destroy(res_irecv);
     MSG_task_destroy(task);
   }
 
-  INFO0("Goodbye now!");
+  XBT_INFO("Goodbye now!");
   return 0;
 }                               /* end_of_sender */
 
@@ -87,13 +88,14 @@ int receiver(int argc, char *argv[])
   int tasks = atof(argv[2]);
   m_task_t *task = xbt_new(m_task_t, tasks);
 
-  xbt_assert1(sscanf(argv[1], "%d", &id),
-              "Invalid argument %s\n", argv[1]);
+  _XBT_GNUC_UNUSED int read;
+  read = sscanf(argv[1], "%d", &id);
+  xbt_assert(read, "Invalid argument %s\n", argv[1]);
   sprintf(mailbox, "receiver-%d", id);
   MSG_process_sleep(10);
   msg_comm_t res_irecv;
   for (i = 0; i < tasks; i++) {
-    INFO1("Wait to receive task %d", i);
+    XBT_INFO("Wait to receive task %d", i);
     task[i] = NULL;
     res_irecv = MSG_task_irecv(&task[i], mailbox);
     xbt_dynar_push_as(comms, msg_comm_t, res_irecv);
@@ -102,15 +104,15 @@ int receiver(int argc, char *argv[])
   /* Here we are waiting for the receiving of all communications */
   m_task_t task_com;
   while (!xbt_dynar_is_empty(comms)) {
-    MSG_error_t err;
+    _XBT_GNUC_UNUSED MSG_error_t err;
     xbt_dynar_remove_at(comms, MSG_comm_waitany(comms), &res_irecv);
     task_com = MSG_comm_get_task(res_irecv);
     MSG_comm_destroy(res_irecv);
-    INFO1("Processing \"%s\"", MSG_task_get_name(task_com));
+    XBT_INFO("Processing \"%s\"", MSG_task_get_name(task_com));
     MSG_task_execute(task_com);
-    INFO1("\"%s\" done", MSG_task_get_name(task_com));
+    XBT_INFO("\"%s\" done", MSG_task_get_name(task_com));
     err = MSG_task_destroy(task_com);
-    xbt_assert0(err == MSG_OK, "MSG_task_destroy failed");
+    xbt_assert(err == MSG_OK, "MSG_task_destroy failed");
   }
   xbt_dynar_free(&comms);
   xbt_free(task);
@@ -120,7 +122,7 @@ int receiver(int argc, char *argv[])
   res_irecv = MSG_task_isend(MSG_task_create(NULL, 0, 0, NULL), mailbox);
   MSG_comm_wait(res_irecv, -1);
   MSG_comm_destroy(res_irecv);
-  INFO0("I'm done. See you!");
+  XBT_INFO("I'm done. See you!");
   return 0;
 }                               /* end_of_receiver */
 
@@ -142,7 +144,7 @@ MSG_error_t test_all(const char *platform_file,
   }
   res = MSG_main();
 
-  INFO1("Simulation time %g", MSG_get_clock());
+  XBT_INFO("Simulation time %g", MSG_get_clock());
   return res;
 }                               /* end_of_test_all */