static XBT_INLINE void SIMIX_rdv_push(smx_rdv_t rdv, smx_action_t comm);
static XBT_INLINE void SIMIX_rdv_remove(smx_rdv_t rdv, smx_action_t comm);
static smx_action_t SIMIX_rdv_get_request(smx_rdv_t rdv, e_smx_comm_type_t type,
- int (*match_fun)(void *, void *), void *);
+ int (*match_fun)(void *, void *), void *);
static void SIMIX_rdv_free(void *data);
void SIMIX_network_init(void)
SIMIX_comm_destroy_internal_actions(action);
+ if (action->comm.detached && action->state != SIMIX_DONE) {
+ /* the communication has failed and was detached:
+ * we have to free the buffer */
+ ((void_f_pvoid_t) action->comm.src_data)(action->comm.src_buff);
+ }
+
xbt_free(action);
}
/* If the communication action is detached then decrease the refcount
* by one, so it will be eliminated by the receivers destroy call */
- if(detached)
+ if (detached) {
+ action->comm.detached = 1;
action->comm.refcount--;
+ }
/* Setup the communication request */
action->comm.src_proc = src_proc;
void SIMIX_comm_finish(smx_action_t action)
{
+ unsigned int destroy_count = 0;
smx_req_t req;
while ((req = xbt_fifo_shift(action->request_list))) {
req->issuer->waiting_action = NULL;
SIMIX_request_answer(req);
+ destroy_count++;
}
+
+ while(destroy_count-- > 0)
+ SIMIX_comm_destroy(action);
}
void SIMIX_post_comm(smx_action_t action)