- action = SIMIX_action_communicate(shost, dhost, "communication", request->datatype->size * request->count, -1.0);
-
- SIMIX_register_action_to_condition(action, request->cond);
-
- for (
- state = SIMIX_action_get_state(action);
- state == SURF_ACTION_READY ||
- state == SURF_ACTION_RUNNING;
- state = SIMIX_action_get_state(action)
- ) {
- SIMIX_cond_wait(request->cond, request->mutex);
- }
-
- SIMIX_mutex_lock(smpi_global->received_message_queues_mutexes[dindex]);
- xbt_fifo_push(smpi_global->received_message_queues[dindex], message);
- SIMIX_mutex_unlock(smpi_global->received_message_queues_mutexes[dindex]);
-
- SIMIX_unregister_action_to_condition(action, request->cond);
- SIMIX_action_destroy(action);
-
- SIMIX_mutex_unlock(request->mutex);
-
- // wake up receiver if necessary
- receiver_process = smpi_global->receiver_processes[dindex];
- if (SIMIX_process_is_suspended(receiver_process)) {
- SIMIX_process_resume(receiver_process);
- }
-
- }
-
- SIMIX_mutex_lock(smpi_global->running_hosts_count_mutex);
- running_hosts_count = smpi_global->running_hosts_count;
- SIMIX_mutex_unlock(smpi_global->running_hosts_count_mutex);
-
- } while (0 < running_hosts_count);
-
- return 0;