-void communicator::send(const char* dest, m_task_t task)
-{
- sent_comm.push_back(MSG_task_isend(task, dest));
- flush_sent();
-}
+ 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;
+ }