- xbt_dynar_t comms = xbt_dynar_new(sizeof(msg_comm_t), NULL);
- while (!sent_comm.empty()) {
- std::for_each(sent_comm.begin(), sent_comm.end(),
- bind(xbt_dynar_push,
- comms, bind(misc::address<msg_comm_t>(), _1)));
- MSG_comm_waitany(comms);
- xbt_dynar_reset(comms);
- sent_comm.remove_if(comm_test_n_destroy);
- }
- xbt_dynar_free(&comms);
+ msg_comm_t comms[sent_comm.size()];
+ std::copy(sent_comm.begin(), sent_comm.end(), comms);
+ MSG_comm_waitall(comms, sent_comm.size(), -1.0);
+ if (!MSG_WAIT_DESTROYS_COMMS)
+ std::for_each(sent_comm.begin(), sent_comm.end(), MSG_comm_destroy);
+ sent_comm.clear();