- }
-}
-
-int communicator::receiver_wrapper(int, char* [])
-{
- communicator* comm;
- comm = static_cast<communicator*>(MSG_process_get_data(MSG_process_self()));
- comm->receiver();
-
- XBT_DEBUG("terminate");
- xbt_mutex_acquire(comm->receiver_mutex);
- comm->receiver_thread = NULL;
- xbt_cond_signal(comm->receiver_cond);
- xbt_mutex_release(comm->receiver_mutex);
-
- return 0;
-}
-
-void communicator::receiver1(msg_comm_t& comm, m_task_t& task, const char* mbox)
-{
- comm_check_n_destroy(comm);
- if (strcmp(MSG_task_get_name(task), "finalize")) {
- XBT_DEBUG("received message on %s", mbox);
- xbt_mutex_acquire(receiver_mutex);
- received.push(task);
- xbt_cond_signal(receiver_cond);
- xbt_mutex_release(receiver_mutex);
- task = NULL;
- comm = MSG_task_irecv(&task, mbox);
- } else {
- XBT_DEBUG("received finalize on %s", mbox);
- MSG_task_destroy(task);
- task = NULL;
- comm = NULL;
+ MSG_comm_waitall(comms, size, -1.0);
+ std::for_each(comms, comms + size, comm_check_n_destroy);
+ delete[] comms;