- 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)
-{
- simgrid::simix::Comm *comm = static_cast<simgrid::simix::Comm*>(synchro);
-
- /* Update synchro state */
- if (comm->src_timeout &&
- comm->src_timeout->getState() == simgrid::surf::Action::State::done)
- synchro->state = SIMIX_SRC_TIMEOUT;
- else if (comm->dst_timeout &&
- comm->dst_timeout->getState() == simgrid::surf::Action::State::done)
- synchro->state = SIMIX_DST_TIMEOUT;
- else if (comm->src_timeout &&
- comm->src_timeout->getState() == simgrid::surf::Action::State::failed)
- synchro->state = SIMIX_SRC_HOST_FAILURE;
- else if (comm->dst_timeout &&
- comm->dst_timeout->getState() == simgrid::surf::Action::State::failed)
- synchro->state = SIMIX_DST_HOST_FAILURE;
- else if (comm->surf_comm &&
- comm->surf_comm->getState() == simgrid::surf::Action::State::failed) {
- 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",
- comm, (int)comm->state, comm->src_proc, comm->dst_proc, comm->detached);
-
- /* destroy the surf actions associated with the Simix communication */
- SIMIX_comm_destroy_internal_actions(comm);
-
- /* if there are simcalls associated with the synchro, then answer them */
- if (xbt_fifo_size(synchro->simcalls)) {
- SIMIX_comm_finish(comm);
- }
-}
-
-void SIMIX_comm_cancel(smx_synchro_t synchro)
-{
- simgrid::simix::Comm *comm = static_cast<simgrid::simix::Comm*>(synchro);
-
- /* if the synchro is a waiting state means that it is still in a mbox */
- /* so remove from it and delete it */
- if (comm->state == SIMIX_WAITING) {
- SIMIX_mbox_remove(comm->mbox, synchro);
- comm->state = SIMIX_CANCELED;
- }
- else if (!MC_is_active() /* when running the MC there are no surf actions */
- && !MC_record_replay_is_active()
- && (comm->state == SIMIX_READY || comm->state == SIMIX_RUNNING)) {
-
- comm->surf_comm->cancel();
- }
-}
-
-/************* synchro Getters **************/
-
-/**
- * \brief get the amount remaining from the communication
- * \param synchro The communication
- */
-double SIMIX_comm_get_remains(smx_synchro_t synchro)
-{
- if(!synchro)
- return 0;
- simgrid::simix::Comm *comm = static_cast<simgrid::simix::Comm*>(synchro);
-
- double remains;
- switch (synchro->state) {
-
- case SIMIX_RUNNING:
- remains = 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)
-{
- simgrid::simix::Comm *comm = static_cast<simgrid::simix::Comm*>(synchro);
-
- return 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)
-{
- simgrid::simix::Comm *comm = static_cast<simgrid::simix::Comm*>(synchro);
-
- return comm->dst_data;
-}
-
-smx_process_t SIMIX_comm_get_src_proc(smx_synchro_t synchro)
-{
- simgrid::simix::Comm *comm = static_cast<simgrid::simix::Comm*>(synchro);
-
- return comm->src_proc;
-}
-
-smx_process_t SIMIX_comm_get_dst_proc(smx_synchro_t synchro)
-{
- simgrid::simix::Comm *comm = static_cast<simgrid::simix::Comm*>(synchro);
-
- return comm->dst_proc;