+ /* put the selectable socket on the queue */
+ trp_remote_proc = (gras_trp_procdata_t)
+ gras_libdata_by_name_from_remote("gras_trp",sock_data->to_process);
+
+ xbt_queue_push(trp_remote_proc->msg_selectable_sockets,&sock);
+
+ /* put message on msg_queue */
+ msg_remote_proc = (gras_msg_procdata_t)
+ gras_libdata_by_name_from_remote("gras_msg",sock_data->to_process);
+ xbt_fifo_push(msg_remote_proc->msg_to_receive_queue,msg);
+
+ /* wait for the receiver */
+ SIMIX_cond_wait(sock_data->cond, sock_data->mutex);
+
+ /* 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");