- DEBUG1("Communication %p complete! Let's check for errors", comm_finished);
-
- /* Make sure that everyone sleeping on that semaphore is awake,
- * and that nobody will ever block on it */
- SIMIX_sem_release_forever(comm_finished->sem);
-
- /* Check for errors */
- if(!SIMIX_host_get_state(SIMIX_host_self())){
- if(comm_finished->rdv)
- SIMIX_rdv_remove(comm_finished->rdv, comm_finished);
- SIMIX_communication_destroy(comm_finished);
- THROW0(host_error, 0, "Host failed");
- } else if (SIMIX_action_get_state(comm_finished->act) == SURF_ACTION_FAILED){
- SIMIX_communication_destroy(comm_finished);
- THROW0(network_error, 0, "Link failure");
- }
- SIMIX_communication_destroy(comm_finished);
-
+ /* Check for errors and cleanup the comm */
+ SIMIX_communication_wait_for_completion(comm_finished,-1);