+/** @brief blocks until the communication terminates or the timeout occurs */
+XBT_INLINE void SIMIX_network_wait(smx_comm_t comm, double timeout)
+{
+ /* If running in model-checking mode then intercept the communication action.
+ * There can be two situations, this is a replay (back-track process) so no
+ * transition needs to be created, or we are expanding a new state and in
+ * consecuence a transition needs to be created and added to the set of
+ * transitions associated to the current state.
+ */
+ if (_surf_do_model_check)
+ MC_trans_intercept_wait(comm);
+
+ /* Wait for communication completion */
+ SIMIX_communication_wait_for_completion(comm, timeout);
+}
+
+/** @Returns whether the (asynchronous) communication is done yet or not */
+XBT_INLINE int SIMIX_network_test(smx_comm_t comm)
+{
+ /* If running in model-checking mode then intercept the communication action.
+ * There can be two situations, this is a replay (back-track process) so no
+ * transition needs to be created, or we are expanding a new state and in
+ * consecuence a transition needs to be created and added to the set of
+ * transitions associated to the current state.
+ */
+ if (_surf_do_model_check)
+ MC_trans_intercept_test(comm);
+
+ /* Copy data if the communication is done */
+ if(comm->sem && !SIMIX_sem_would_block(comm->sem)){
+ /* Copy network data */
+ SIMIX_network_copy_data(comm);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/** @brief wait for the completion of any communication of a set
+ *
+ * @Returns the rank in the dynar of communication which finished; destroy it after identifying which one it is
+ */
+unsigned int SIMIX_network_waitany(xbt_dynar_t comms)
+{
+ xbt_dynar_t sems = xbt_dynar_new(sizeof(smx_sem_t),NULL);
+ unsigned int cursor, found_comm=-1;
+ smx_comm_t comm,comm_finished=NULL;
+
+ /* If running in model-checking mode then intercept the communication action.
+ * There can be two situations, this is a replay (back-track process) so no
+ * transition needs to be created, or we are expanding a new state and in
+ * consecuence a transition needs to be created and added to the set of
+ * transitions associated to the current state.
+ */
+ if (_surf_do_model_check)
+ MC_trans_intercept_waitany(comms);
+
+ xbt_dynar_foreach(comms,cursor,comm)
+ xbt_dynar_push(sems,&(comm->sem));