summaryrefslogtreecommitdiffstats
path: root/src/H5O.c
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2016-11-26 15:47:32 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2016-11-26 15:47:32 (GMT)
commita8d1aff23568c0f64fa16cfbb37d7741bb922a60 (patch)
tree153d5a07966aaed7755168df983bb2c3445bb1dd /src/H5O.c
parent72ecaf0940f8d6df7bedf14376ea3f2224efc0c6 (diff)
downloadhdf5-a8d1aff23568c0f64fa16cfbb37d7741bb922a60.zip
hdf5-a8d1aff23568c0f64fa16cfbb37d7741bb922a60.tar.gz
hdf5-a8d1aff23568c0f64fa16cfbb37d7741bb922a60.tar.bz2
Tentative fix for valgrind issues related to EoC.
Adds /*out*/ parameters to H5O_close() and H5F_try_close() so that H5D/G_close() will know when H5O_close() has triggered a file close and thus the file struct is not reliable. Also removes the H5F_CLOSING() macro and related which were formerly used to check if the file was closing.
Diffstat (limited to 'src/H5O.c')
-rw-r--r--src/H5O.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/H5O.c b/src/H5O.c
index f12bfed..713be04 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -1558,7 +1558,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_close(H5O_loc_t *loc)
+H5O_close(H5O_loc_t *loc, hbool_t *file_closed /*out*/)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -1569,6 +1569,15 @@ H5O_close(H5O_loc_t *loc)
HDassert(loc->file);
HDassert(H5F_NOPEN_OBJS(loc->file) > 0);
+ /* Set the file_closed flag to the default value.
+ * This flag lets downstream code know if the file struct is
+ * still accessible and/or likely to contain useful data.
+ * It's needed by the evict-on-close code. Clients can ignore
+ * this value by passing in NULL.
+ */
+ if(file_closed)
+ *file_closed = FALSE;
+
/* Decrement open-lock counters */
H5F_DECR_NOPEN_OBJS(loc->file);
@@ -1589,7 +1598,7 @@ H5O_close(H5O_loc_t *loc)
*/
if(H5F_NOPEN_OBJS(loc->file) == H5F_NMOUNTS(loc->file))
/* Attempt to close down the file hierarchy */
- if(H5F_try_close(loc->file) < 0)
+ if(H5F_try_close(loc->file, file_closed) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCLOSEFILE, FAIL, "problem attempting file close")
/* Release location information */
@@ -2782,7 +2791,7 @@ H5O_loc_free(H5O_loc_t *loc)
H5F_DECR_NOPEN_OBJS(loc->file);
loc->holding_file = FALSE;
if(H5F_NOPEN_OBJS(loc->file) <= 0) {
- if(H5F_try_close(loc->file) < 0)
+ if(H5F_try_close(loc->file, NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close file")
} /* end if */
} /* end if */