X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/0ed506b0a9c949af9b2f672ac917ecaedca266c0..d78311982007a2c778ff692c35c9d2787642c199:/src/xbt/mmalloc/detach.c diff --git a/src/xbt/mmalloc/detach.c b/src/xbt/mmalloc/detach.c index 5dfaf4224d..8df6e5e827 100644 --- a/src/xbt/mmalloc/detach.c +++ b/src/xbt/mmalloc/detach.c @@ -14,6 +14,20 @@ #include #include "mmprivate.h" +/* Terminate access to a mmalloc managed region, but do not free its content. + * This is for example useful for the base region where ldl stores its data + * because it leaves the place after us. + */ +void mmalloc_detach_no_free(void *md) +{ + struct mdesc *mdp = md; + + if(--mdp->refcount == 0){ + LOCK(mdp) ; + sem_destroy(&mdp->sem); + } +} + /* Terminate access to a mmalloc managed region by unmapping all memory pages associated with the region, and closing the file descriptor if it is one that we opened. @@ -28,16 +42,6 @@ region we are about to unmap, so we first make a local copy of it on the stack and use the copy. */ -void mmalloc_pre_detach(void *md) -{ - struct mdesc *mdp = md; - - if(--mdp->refcount == 0){ - LOCK(mdp) ; - sem_destroy(&mdp->sem); - } -} - void *mmalloc_detach(void *md) { struct mdesc *mdp = (struct mdesc *)md; @@ -51,7 +55,7 @@ void *mmalloc_detach(void *md) mdptemp->next_mdesc = mdp->next_mdesc; - mmalloc_pre_detach(md); + mmalloc_detach_no_free(md); mtemp = *(struct mdesc *) md; /* Now unmap all the pages associated with this region by asking for a