- DEBUG1("Prepare to send a message to %s",
- MSG_host_get_name (sock_data->to_host));
- if (MSG_task_put_with_timeout(task, sock_data->to_host,sock_data->to_chan,60.0) != MSG_OK)
- THROW0(system_error,0,"Problem during the MSG_task_put with timeout 60");
+ /* 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);
+ SIMIX_register_condition_to_action(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);
+ /* error treatmeant */
+
+ /* cleanup structures */
+ SIMIX_action_destroy(act);
+ SIMIX_mutex_unlock(sock_data->mutex);
+
+ VERB0("Message sent");