summaryrefslogtreecommitdiffstats
path: root/src/H5O.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5O.c')
-rw-r--r--src/H5O.c34
1 files changed, 9 insertions, 25 deletions
diff --git a/src/H5O.c b/src/H5O.c
index 7abc16e..a15d9ac 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -412,7 +412,7 @@ H5O_close(H5G_entry_t *obj_ent)
#ifdef H5O_DEBUG
if (H5DEBUG(O)) {
- if (obj_ent->file->closing && 1==obj_ent->file->shared->nrefs) {
+ if (obj_ent->file->file_id < 0 && 1==obj_ent->file->shared->nrefs) {
HDfprintf(H5DEBUG(O), "< %a auto %lu remaining\n",
obj_ent->header,
(unsigned long)(obj_ent->file->nopen_objs));
@@ -423,28 +423,13 @@ H5O_close(H5G_entry_t *obj_ent)
#endif
/*
- * If the file open-lock count has reached the number of open mount points
- * (each of which has a group open in the file) and the file has a close
- * pending then close the file and remove it from the H5I_FILE_CLOSING ID
- * group.
+ * If the file open object count has reached the number of open mount points
+ * (each of which has a group open in the file) attempt to close the file.
*/
- /* Check for just mount points holding file open */
- if(obj_ent->file->mtab.nmounts == obj_ent->file->nopen_objs && obj_ent->file->closing) {
- unsigned u; /* Local index variable */
- hbool_t really_close; /* Whether to delay the file close by going to a "closing" state */
-
- /* Check for open groups on mount points */
- really_close = TRUE;
- for(u = 0; u < obj_ent->file->mtab.nmounts; u++) {
- if(H5G_get_shared_count(obj_ent->file->mtab.child[u].group) > 1) {
- really_close = FALSE;
- break;
- } /* end if */
- } /* end for */
-
- /* If we really want to close this file now */
- if(really_close)
- H5I_dec_ref(obj_ent->file->closing);
+ if(obj_ent->file->nopen_objs == obj_ent->file->mtab.nmounts) {
+ /* Attempt to close down the file hierarchy */
+ if(H5F_try_close(obj_ent->file) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "problem attempting file close")
} /* end if */
/* Free the ID to name buffers */
@@ -452,7 +437,7 @@ H5O_close(H5G_entry_t *obj_ent)
done:
FUNC_LEAVE_NOAPI(ret_value);
-}
+} /* end H5O_close() */
/*-------------------------------------------------------------------------
@@ -1920,7 +1905,7 @@ H5O_modify_real(H5G_entry_t *ent, const H5O_class_t *type, int overwrite,
HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "message not found");
} /* end if */
- /* Check for creating new message */
+ /* Check for creating new message */
if (overwrite < 0) {
/* Create a new message */
if((idx=H5O_new_mesg(ent->file,oh,&flags,type,mesg,&sh_mesg,&type,&mesg,dxpl_id,&oh_flags))==UFAIL)
@@ -2265,7 +2250,6 @@ H5O_write_mesg(H5O_t *oh, unsigned idx, const H5O_class_t *type,
unsigned * oh_flags_ptr)
{
H5O_mesg_t *idx_msg; /* Pointer to message to modify */
-
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5O_write_mesg);