diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2016-12-01 09:41:13 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2016-12-01 09:41:13 (GMT) |
commit | 5d7d029b97b36d1c380cef82d637342921bf3a1d (patch) | |
tree | 76ac3ff4b2240412995ef5902f62601dc9d529f1 /src/H5Fint.c | |
parent | 65be68a17d1e5bec7e51e5f3e2e03d22163f7817 (diff) | |
parent | 63bcd73f1f53a8b4bb31083cbc30f9a90663438f (diff) | |
download | hdf5-5d7d029b97b36d1c380cef82d637342921bf3a1d.zip hdf5-5d7d029b97b36d1c380cef82d637342921bf3a1d.tar.gz hdf5-5d7d029b97b36d1c380cef82d637342921bf3a1d.tar.bz2 |
Merge branch 'develop' of https://bitbucket.hdfgroup.org/scm/~koziol/hdf5 into develop_swmr_merge
Diffstat (limited to 'src/H5Fint.c')
-rw-r--r-- | src/H5Fint.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/src/H5Fint.c b/src/H5Fint.c index 152148d..9cf129c 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -1349,7 +1349,7 @@ H5F_close(H5F_t *f) f->file_id = -1; /* Attempt to close the file/mount hierarchy */ - if(H5F_try_close(f) < 0) + if(H5F_try_close(f, NULL) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close file") done: @@ -1373,7 +1373,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_try_close(H5F_t *f) +H5F_try_close(H5F_t *f, hbool_t *was_closed /*out*/) { unsigned nopen_files = 0; /* Number of open files in file/mount hierarchy */ unsigned nopen_objs = 0; /* Number of open objects in file/mount hierarchy */ @@ -1385,9 +1385,21 @@ H5F_try_close(H5F_t *f) HDassert(f); HDassert(f->shared); + /* Set the was_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(was_closed) + *was_closed = FALSE; + /* Check if this file is already in the process of closing */ - if(f->closing) + if(f->closing) { + if(was_closed) + *was_closed = TRUE; HGOTO_DONE(SUCCEED) + } /* end if */ /* Get the number of open objects and open files on this file/mount hierarchy */ if(H5F_mount_count_ids(f, &nopen_files, &nopen_objs) < 0) @@ -1488,7 +1500,7 @@ H5F_try_close(H5F_t *f) * hierarchy if so. */ if(f->parent) - if(H5F_try_close(f->parent) < 0) + if(H5F_try_close(f->parent, NULL) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close parent file") /* Unmount and close each child before closing the current file. */ @@ -1514,6 +1526,9 @@ H5F_try_close(H5F_t *f) if(H5F_dest(f, H5AC_ind_read_dxpl_id, TRUE) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "problems closing file") + /* Since we closed the file, this should be set to TRUE */ + if(was_closed) + *was_closed = TRUE; done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_try_close() */ |