- SIMIX_comm_destroy(synchro);
-}
-
-/**
- * \brief This function is called when a Surf communication synchro is finished.
- * \param synchro the corresponding Simix communication
- */
-void SIMIX_post_comm(smx_synchro_t synchro)
-{
- /* Update synchro state */
- if (synchro->comm.src_timeout &&
- synchro->comm.src_timeout->getState() == simgrid::surf::Action::State::done)
- synchro->state = SIMIX_SRC_TIMEOUT;
- else if (synchro->comm.dst_timeout &&
- synchro->comm.dst_timeout->getState() == simgrid::surf::Action::State::done)
- synchro->state = SIMIX_DST_TIMEOUT;
- else if (synchro->comm.src_timeout &&
- synchro->comm.src_timeout->getState() == simgrid::surf::Action::State::failed)
- synchro->state = SIMIX_SRC_HOST_FAILURE;
- else if (synchro->comm.dst_timeout &&
- synchro->comm.dst_timeout->getState() == simgrid::surf::Action::State::failed)
- synchro->state = SIMIX_DST_HOST_FAILURE;
- else if (synchro->comm.surf_comm &&
- synchro->comm.surf_comm->getState() == simgrid::surf::Action::State::failed) {
- XBT_DEBUG("Puta madre. Surf says that the link broke");
- synchro->state = SIMIX_LINK_FAILURE;
- } else
- synchro->state = SIMIX_DONE;
-
- XBT_DEBUG("SIMIX_post_comm: comm %p, state %d, src_proc %p, dst_proc %p, detached: %d",
- synchro, (int)synchro->state, synchro->comm.src_proc, synchro->comm.dst_proc, synchro->comm.detached);
-
- /* destroy the surf actions associated with the Simix communication */
- SIMIX_comm_destroy_internal_actions(synchro);
-
- /* if there are simcalls associated with the synchro, then answer them */
- if (xbt_fifo_size(synchro->simcalls)) {
- SIMIX_comm_finish(synchro);
- }
-}
-
-void SIMIX_comm_cancel(smx_synchro_t synchro)
-{
- /* if the synchro is a waiting state means that it is still in a rdv */
- /* so remove from it and delete it */
- if (synchro->state == SIMIX_WAITING) {
- SIMIX_rdv_remove(synchro->comm.rdv, synchro);
- synchro->state = SIMIX_CANCELED;
- }
- else if (!MC_is_active() /* when running the MC there are no surf actions */
- && !MC_record_replay_is_active()
- && (synchro->state == SIMIX_READY || synchro->state == SIMIX_RUNNING)) {
-
- synchro->comm.surf_comm->cancel();
- }
-}
-
-void SIMIX_comm_suspend(smx_synchro_t synchro)
-{
- /*FIXME: shall we suspend also the timeout synchro? */
- if (synchro->comm.surf_comm)
- synchro->comm.surf_comm->suspend();
- /* in the other case, the action will be suspended on creation, in SIMIX_comm_start() */
-}
-
-void SIMIX_comm_resume(smx_synchro_t synchro)
-{
- /*FIXME: check what happen with the timeouts */
- if (synchro->comm.surf_comm)
- synchro->comm.surf_comm->resume();
- /* in the other case, the synchro were not really suspended yet, see SIMIX_comm_suspend() and SIMIX_comm_start() */
-}
-
-
-/************* synchro Getters **************/
-
-/**
- * \brief get the amount remaining from the communication
- * \param synchro The communication
- */
-double SIMIX_comm_get_remains(smx_synchro_t synchro)
-{
- double remains;
-
- if(!synchro){
- return 0;
- }
-
- switch (synchro->state) {
-
- case SIMIX_RUNNING:
- remains = synchro->comm.surf_comm->getRemains();
- break;
-
- case SIMIX_WAITING:
- case SIMIX_READY:
- remains = 0; /*FIXME: check what should be returned */
- break;
-
- default:
- remains = 0; /*FIXME: is this correct? */
- break;
- }
- return remains;
-}
-
-e_smx_state_t SIMIX_comm_get_state(smx_synchro_t synchro)
-{
- return synchro->state;
-}
-
-/**
- * \brief Return the user data associated to the sender of the communication
- * \param synchro The communication
- * \return the user data
- */
-void* SIMIX_comm_get_src_data(smx_synchro_t synchro)
-{
- return synchro->comm.src_data;
-}
-
-/**
- * \brief Return the user data associated to the receiver of the communication
- * \param synchro The communication
- * \return the user data
- */
-void* SIMIX_comm_get_dst_data(smx_synchro_t synchro)
-{
- return synchro->comm.dst_data;
-}
-
-smx_process_t SIMIX_comm_get_src_proc(smx_synchro_t synchro)
-{
- return synchro->comm.src_proc;
-}
-
-smx_process_t SIMIX_comm_get_dst_proc(smx_synchro_t synchro)
-{
- return synchro->comm.dst_proc;