- SIMIX_cond_wait_timeout(task->simdata->cond, task->simdata->mutex,
- max_duration);
- /* verify if the timeout happened and the communication didn't started yet */
- if (task->simdata->comm == NULL) {
- task->simdata->using--;
- process->simdata->waiting_task = NULL;
- xbt_fifo_remove(((simdata_host_t) remote_host->simdata)->
- mbox[channel], task);
- if (task->simdata->receiver) {
- task->simdata->receiver->simdata->waiting_task = NULL;
+ xbt_ex_t e;
+ TRY {
+ SIMIX_cond_wait_timeout(task->simdata->cond, task->simdata->mutex,
+ max_duration);
+ } CATCH(e) {
+ if(e.category==timeout_error) {
+ xbt_ex_free(e);
+ /* verify if the timeout happened and the communication didn't started yet */
+ if (task->simdata->comm == NULL) {
+ task->simdata->using--;
+ process->simdata->waiting_task = NULL;
+ xbt_fifo_remove(((simdata_host_t) remote_host->simdata)->
+ mbox[channel], task);
+ if (task->simdata->receiver) {
+ task->simdata->receiver->simdata->waiting_task = NULL;
+ }
+ task->simdata->sender = NULL;
+ SIMIX_mutex_unlock(task->simdata->mutex);
+ MSG_RETURN(MSG_TRANSFER_FAILURE);
+ }
+ } else {
+ RETHROW;