- int (*match_fun)(void *, void *), void *data)
-{
- smx_action_t action;
-
- /* Look for communication request matching our needs.
- If it is not found then create it and push it into the rendez-vous point */
- action = SIMIX_rdv_get_request(rdv, SIMIX_COMM_RECEIVE, match_fun, data);
+ int (*match_fun)(void *, void *,smx_action_t),
+ void (*clean_fun)(void *), // used to free the action in case of problem after a detached send
+ void *data,
+ int detached)
+{
+ /* Prepare an action describing us, so that it gets passed to the user-provided filter of other side */
+ smx_action_t this_action = SIMIX_comm_new(SIMIX_COMM_SEND);
+
+ /* Look for communication action matching our needs. We also provide a description of
+ * ourself so that the other side also gets a chance of choosing if it wants to match with us.
+ *
+ * If it is not found then push our communication into the rendez-vous point */
+ smx_action_t other_action = SIMIX_rdv_get_comm(rdv, SIMIX_COMM_RECEIVE, match_fun, data, this_action);
+
+ if (!other_action) {
+ other_action = this_action;
+ SIMIX_rdv_push(rdv, this_action);
+ } else {
+ SIMIX_comm_destroy(this_action);
+ --smx_total_comms; // this creation was a pure waste