XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
"Messages specific for this msg example");
+/** @addtogroup MSG_examples
+ *
+ * - <b>msg/icomms/peer3.c</b>: demonstrates the @ref MSG_comm_waitany function
+ */
+
int sender(int argc, char *argv[]);
int receiver(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 */
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 */
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);
/* 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);
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 */
/* MSG_config("workstation/model","KCCFLN05"); */
{ /* Simulation setting */
- MSG_set_channel_number(0);
MSG_create_environment(platform_file);
}
{ /* Application deployment */
}
res = MSG_main();
- INFO1("Simulation time %g", MSG_get_clock());
+ XBT_INFO("Simulation time %g", MSG_get_clock());
return res;
} /* end_of_test_all */