- if (MSG_task_put(task, sock_data->to_host,sock_data->to_chan) != MSG_OK)
- THROW0(system_error,0,"Problem during the MSG_task_put");
+ /* creates simix action and waits its ends, waits in the sender host
+ condition */
+ act = SIMIX_action_communicate(SIMIX_host_self(),
+ sock_data->to_host, msgtype->name,
+ (double) whole_payload_size, -1);
+ SIMIX_register_action_to_condition(act, sock_data->cond);
+
+ VERB5("Sending to %s(%s) a message type '%s' kind '%s' ID %lu",
+ SIMIX_host_get_name(sock_data->to_host),
+ SIMIX_process_get_name(sock_data->to_process),
+ msg->type->name, e_gras_msg_kind_names[msg->kind], msg->ID);
+
+ SIMIX_cond_wait(sock_data->cond, sock_data->mutex);
+ SIMIX_unregister_action_to_condition(act, sock_data->cond);
+ /* error treatmeant (FIXME) */
+
+ /* cleanup structures */
+ SIMIX_action_destroy(act);
+ SIMIX_mutex_unlock(sock_data->mutex);
+
+ VERB0("Message sent");