- auto i = boost::range::find(synchro->simcalls, simcall);
- if (i != synchro->simcalls.end())
- synchro->simcalls.erase(i);
- }
-}
-
-/**
- * \brief Starts the simulation of a communication synchro.
- * \param synchro the communication synchro
- */
-static inline void SIMIX_comm_start(simgrid::kernel::activity::CommImplPtr comm)
-{
- /* If both the sender and the receiver are already there, start the communication */
- if (comm->state == SIMIX_READY) {
-
- simgrid::s4u::Host* sender = comm->src_proc->host;
- simgrid::s4u::Host* receiver = comm->dst_proc->host;
-
- comm->surf_comm = surf_network_model->communicate(sender, receiver, comm->task_size, comm->rate);
- comm->surf_comm->setData(comm.get());
- comm->state = SIMIX_RUNNING;
-
- XBT_DEBUG("Starting communication %p from '%s' to '%s' (surf_action: %p)", comm.get(), sender->cname(),
- receiver->cname(), comm->surf_comm);
-
- /* If a link is failed, detect it immediately */
- if (comm->surf_comm->getState() == simgrid::surf::Action::State::failed) {
- XBT_DEBUG("Communication from '%s' to '%s' failed to start because of a link failure", sender->cname(),
- receiver->cname());
- comm->state = SIMIX_LINK_FAILURE;
- comm->cleanupSurf();
- }
-
- /* If any of the process is suspend, create the synchro but stop its execution,
- it will be restarted when the sender process resume */
- if (SIMIX_process_is_suspended(comm->src_proc) || SIMIX_process_is_suspended(comm->dst_proc)) {
- if (SIMIX_process_is_suspended(comm->src_proc))
- XBT_DEBUG("The communication is suspended on startup because src (%s@%s) was suspended since it initiated the "
- "communication",
- comm->src_proc->cname(), comm->src_proc->host->cname());
- else
- XBT_DEBUG("The communication is suspended on startup because dst (%s@%s) was suspended since it initiated the "
- "communication",
- comm->dst_proc->cname(), comm->dst_proc->host->cname());
-
- comm->surf_comm->suspend();
- }