-/**
- * \brief Checks if there is a communication synchro queued in a fifo matching our needs
- * \param type The type of communication we are looking for (comm_send, comm_recv)
- * \return The communication synchro if found, NULL otherwise
- */
-smx_synchro_t SIMIX_fifo_get_comm(xbt_fifo_t fifo, e_smx_comm_type_t type,
- int (*match_fun)(void *, void *,smx_synchro_t),
- void *this_user_data, smx_synchro_t my_synchro)
-{
- smx_synchro_t synchro;
- xbt_fifo_item_t item;
- void* other_user_data = NULL;
-
- xbt_fifo_foreach(fifo, item, synchro, smx_synchro_t) {
- if (synchro->comm.type == SIMIX_COMM_SEND) {
- other_user_data = synchro->comm.src_data;
- } else if (synchro->comm.type == SIMIX_COMM_RECEIVE) {
- other_user_data = synchro->comm.dst_data;
- }
- if (synchro->comm.type == type &&
- (!match_fun || match_fun(this_user_data, other_user_data, synchro)) &&
- (!synchro->comm.match_fun || synchro->comm.match_fun(other_user_data, this_user_data, my_synchro))) {
- XBT_DEBUG("Found a matching communication synchro %p", synchro);
- xbt_fifo_remove_item(fifo, item);
- xbt_fifo_free_item(item);
- synchro->comm.refcount++;
-#ifdef HAVE_MC
- synchro->comm.rdv_cpy = synchro->comm.rdv;
-#endif
- synchro->comm.rdv = NULL;
- return synchro;