From: cristianrosa Date: Mon, 31 Jan 2011 15:01:04 +0000 (+0000) Subject: Make SIMIX cleanup the user data of the detached isend communication actions. X-Git-Tag: v3.6_beta2~395 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/00e8231fa94528961cddaa1fe35e232de5438e76?hp=030e7d63a2fc3a0f82f5c820e1d0ac02d2021ba2 Make SIMIX cleanup the user data of the detached isend communication actions. git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@9534 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/include/msg/msg.h b/include/msg/msg.h index 6764b1a392..2003d336ac 100644 --- a/include/msg/msg.h +++ b/include/msg/msg.h @@ -178,7 +178,7 @@ XBT_PUBLIC(MSG_error_t) MSG_task_receive(m_task_t * task, const char *alias); XBT_PUBLIC(msg_comm_t) MSG_task_isend(m_task_t task, const char *alias); -XBT_PUBLIC(void) MSG_task_dsend(m_task_t task, const char *alias); +XBT_PUBLIC(void) MSG_task_dsend(m_task_t task, const char *alias, void_f_pvoid_t cleanup); XBT_PUBLIC(msg_comm_t) MSG_task_irecv(m_task_t * task, const char *alias); XBT_PUBLIC(int) MSG_comm_test(msg_comm_t comm); XBT_PUBLIC(int) MSG_comm_testany(xbt_dynar_t comms); diff --git a/src/msg/gos.c b/src/msg/gos.c index 9ab4dc018f..4c4480e2ee 100644 --- a/src/msg/gos.c +++ b/src/msg/gos.c @@ -423,7 +423,7 @@ msg_comm_t MSG_task_isend(m_task_t task, const char *alias) * \param task a #m_task_t to send on another location. * \param alias name of the mailbox to sent the task to */ -void MSG_task_dsend(m_task_t task, const char *alias) +void MSG_task_dsend(m_task_t task, const char *alias, void_f_pvoid_t cleanup) { simdata_task_t t_simdata = NULL; m_process_t process = MSG_process_self(); @@ -445,13 +445,8 @@ void MSG_task_dsend(m_task_t task, const char *alias) msg_global->sent_msg++; /* Send it by calling SIMIX network layer */ - msg_comm_t comm = xbt_new0(s_msg_comm_t, 1); - comm->task_sent = task; - comm->task_received = NULL; - comm->status = MSG_OK; - SIMIX_req_comm_isend(mailbox, t_simdata->message_size, - t_simdata->rate, task, sizeof(void *), NULL, NULL, 1); - /*t_simdata->comm = comm->s_comm; FIXME: is the field t_simdata->comm still useful? */ + SIMIX_req_comm_isend(mailbox, t_simdata->message_size, + t_simdata->rate, task, sizeof(void *), NULL, cleanup, 1); } /** \ingroup msg_gos_functions diff --git a/src/simix/private.h b/src/simix/private.h index b7978875d9..19917336c8 100644 --- a/src/simix/private.h +++ b/src/simix/private.h @@ -89,6 +89,7 @@ typedef struct s_smx_action { e_smx_comm_type_t type; /* Type of the communication (SIMIX_COMM_SEND or SIMIX_COMM_RECEIVE) */ smx_rdv_t rdv; /* Rendez-vous where the comm is queued */ int refcount; /* Number of processes involved in the cond */ + int detached; /* If detached or not */ /* Surf action data */ surf_action_t surf_comm; /* The Surf communication action encapsulated */ diff --git a/src/simix/smx_network.c b/src/simix/smx_network.c index 11b84c6d64..bc09a3e34b 100644 --- a/src/simix/smx_network.c +++ b/src/simix/smx_network.c @@ -219,6 +219,9 @@ void SIMIX_comm_destroy(smx_action_t action) SIMIX_comm_destroy_internal_actions(action); + if(action->comm.detached) + ((void_f_pvoid_t)action->comm.src_data)(action->comm.src_buff); + xbt_free(action); } @@ -265,8 +268,10 @@ smx_action_t SIMIX_comm_isend(smx_process_t src_proc, smx_rdv_t rdv, /* 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;