-static void SIMIX_comm_copy_data(smx_activity_t comm);
-static void SIMIX_comm_start(smx_activity_t synchro);
-static simgrid::kernel::activity::CommImplPtr
-_find_matching_comm(boost::circular_buffer_space_optimized<smx_activity_t>* deque, e_smx_comm_type_t type,
- int (*match_fun)(void*, void*, smx_activity_t), void* user_data, smx_activity_t my_synchro,
- bool remove_matching);
-
-/**
- * \brief Checks if there is a communication activity queued in a deque matching our needs
- * \param type The type of communication we are looking for (comm_send, comm_recv)
- * \return The communication activity if found, nullptr otherwise
- */
-static simgrid::kernel::activity::CommImplPtr
-_find_matching_comm(boost::circular_buffer_space_optimized<smx_activity_t>* deque, e_smx_comm_type_t type,
- int (*match_fun)(void*, void*, smx_activity_t), void* this_user_data, smx_activity_t my_synchro,
- bool remove_matching)
-{
- void* other_user_data = nullptr;
-
- for(auto it = deque->begin(); it != deque->end(); it++){
- smx_activity_t synchro = *it;
- simgrid::kernel::activity::CommImplPtr comm =
- boost::dynamic_pointer_cast<simgrid::kernel::activity::CommImpl>(synchro);
-
- if (comm->type == SIMIX_COMM_SEND) {
- other_user_data = comm->src_data;
- } else if (comm->type == SIMIX_COMM_RECEIVE) {
- other_user_data = comm->dst_data;
- }
- if (comm->type == type && (match_fun == nullptr || match_fun(this_user_data, other_user_data, synchro)) &&
- (not comm->match_fun || comm->match_fun(other_user_data, this_user_data, my_synchro))) {
- XBT_DEBUG("Found a matching communication synchro %p", comm);
- if (remove_matching)
- deque->erase(it);
- comm->ref();
-#if SIMGRID_HAVE_MC
- comm->mbox_cpy = comm->mbox;
-#endif
- comm->mbox = nullptr;
- return comm;
- }
- XBT_DEBUG("Sorry, communication synchro %p does not match our needs:"
- " its type is %d but we are looking for a comm of type %d (or maybe the filtering didn't match)",
- comm, (int)comm->type, (int)type);
- }
- XBT_DEBUG("No matching communication synchro found");
- return nullptr;
-}