- msg_comm_t comm = MSG_task_isend(task, dest);
- sent_comm.push_back(comm);
-}
-
-bool communicator::recv(message*& msg, m_host_t& from, bool wait)
-{
- bool restart;
- msg = NULL;
-
- do {
- if (ctrl_comm && comm_test_n_destroy(ctrl_comm)) {
- msg = (message* )MSG_task_get_data(ctrl_task);
- from = MSG_task_get_source(ctrl_task);
- MSG_task_destroy(ctrl_task);
- ctrl_task = NULL;
- ctrl_comm =
- (!ctrl_close_is_last || msg->get_type() != message::CTRL_CLOSE)
- ? MSG_task_irecv(&ctrl_task, get_ctrl_mbox())
- : NULL;
-
- } else if (data_comm && comm_test_n_destroy(data_comm)) {
- msg = (message* )MSG_task_get_data(data_task);
- from = MSG_task_get_source(data_task);
- MSG_task_destroy(data_task);
- data_task = NULL;
- data_comm =
- (!data_close_is_last || msg->get_type() != message::DATA_CLOSE)
- ? MSG_task_irecv(&data_task, get_data_mbox())
- : NULL;
- }
-
- restart = wait && !msg && (ctrl_comm || data_comm);
- if (restart) {
- xbt_dynar_t comms = xbt_dynar_new(sizeof(msg_comm_t), NULL);
- if (ctrl_comm)
- xbt_dynar_push(comms, &ctrl_comm);
- if (data_comm)
- xbt_dynar_push(comms, &data_comm);
- MSG_comm_waitany(comms);
- xbt_dynar_free(&comms);
- }
- } while (restart);
-
- return msg != NULL;
+ TRACE_msg_set_task_category(task,
+ msg->get_type() == message::LOAD ?
+ TRACE_CAT_DATA : TRACE_CAT_CTRL);
+ return MSG_task_isend(task, dest);