summaryrefslogtreecommitdiffstats
path: root/src/H5O.c
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2008-08-19 16:35:16 (GMT)
committerNeil Fortner <nfortne2@hdfgroup.org>2008-08-19 16:35:16 (GMT)
commita59d91d19251163b0e9cfeb351f8a069d6e6fd64 (patch)
treef70ca52185d816ce92ac89414d4fa331ba600b68 /src/H5O.c
parent936e52b581b3f4739e12c331d93ba6259a2cb5e0 (diff)
downloadhdf5-a59d91d19251163b0e9cfeb351f8a069d6e6fd64.zip
hdf5-a59d91d19251163b0e9cfeb351f8a069d6e6fd64.tar.gz
hdf5-a59d91d19251163b0e9cfeb351f8a069d6e6fd64.tar.bz2
[svn-r15485] Purpose: Allow library to shut down properly when objects have reference count
> 1. Description: Added a new field 'app_count' to H5I_id_info_t struct, to track the reference count on an id due to the application. the old 'count' field tracks the total. Generally any id visible to the application gets placed in app_count. Added app_ref boolean parameter to H5I_inc_ref, H5I_dec_ref, H5I_register, H5I_clear_type, and a few other functions, to specify whether the operation(s) being performed on the id(s) are due to the application (TRUE) or not (FALSE). Test added for this case. Tested: kagiso, smirom, linew (h5committest)
Diffstat (limited to 'src/H5O.c')
-rw-r--r--src/H5O.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/H5O.c b/src/H5O.c
index ddc23ab..5feee05 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -238,7 +238,7 @@ H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
/* Open the object */
- if((ret_value = H5O_open_name(&loc, name, lapl_id)) < 0)
+ if((ret_value = H5O_open_name(&loc, name, lapl_id, TRUE)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open object")
done:
@@ -309,7 +309,7 @@ H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
loc_found = TRUE;
/* Open the object */
- if((ret_value = H5O_open_by_loc(&obj_loc, H5AC_dxpl_id)) < 0)
+ if((ret_value = H5O_open_by_loc(&obj_loc, H5AC_dxpl_id, TRUE)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open object")
done:
@@ -385,7 +385,7 @@ H5Oopen_by_addr(hid_t loc_id, haddr_t addr)
H5G_name_reset(obj_loc.path); /* objects opened through this routine don't have a path name */
/* Open the object */
- if((ret_value = H5O_open_by_loc(&obj_loc, H5AC_dxpl_id)) < 0)
+ if((ret_value = H5O_open_by_loc(&obj_loc, H5AC_dxpl_id, TRUE)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open object")
done:
@@ -1012,7 +1012,7 @@ H5Oclose(hid_t object_id)
case(H5I_DATASET):
if(H5I_object(object_id) == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid object")
- if(H5I_dec_ref(object_id) < 0)
+ if(H5I_dec_ref(object_id, TRUE) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "unable to close object")
break;
@@ -1259,7 +1259,7 @@ done:
*-------------------------------------------------------------------------
*/
hid_t
-H5O_open_name(H5G_loc_t *loc, const char *name, hid_t lapl_id)
+H5O_open_name(H5G_loc_t *loc, const char *name, hid_t lapl_id, hbool_t app_ref)
{
H5G_loc_t obj_loc; /* Location used to open group */
H5G_name_t obj_path; /* Opened object group hier. path */
@@ -1284,7 +1284,7 @@ H5O_open_name(H5G_loc_t *loc, const char *name, hid_t lapl_id)
loc_found = TRUE;
/* Open the object */
- if((ret_value = H5O_open_by_loc(&obj_loc, H5AC_ind_dxpl_id)) < 0)
+ if((ret_value = H5O_open_by_loc(&obj_loc, H5AC_ind_dxpl_id, app_ref)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open object")
done:
@@ -1310,7 +1310,7 @@ done:
*-------------------------------------------------------------------------
*/
hid_t
-H5O_open_by_loc(const H5G_loc_t *obj_loc, hid_t dxpl_id)
+H5O_open_by_loc(const H5G_loc_t *obj_loc, hid_t dxpl_id, hbool_t app_ref)
{
const H5O_obj_class_t *obj_class; /* Class of object for location */
hid_t ret_value; /* Return value */
@@ -1325,7 +1325,7 @@ H5O_open_by_loc(const H5G_loc_t *obj_loc, hid_t dxpl_id)
/* Call the object class's 'open' routine */
HDassert(obj_class->open);
- if((ret_value = obj_class->open(obj_loc, dxpl_id)) < 0)
+ if((ret_value = obj_class->open(obj_loc, dxpl_id, app_ref)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object")
done:
@@ -2805,7 +2805,7 @@ H5O_visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
/* Open the object */
/* (Takes ownership of the obj_loc information) */
- if((obj_id = H5O_open_by_loc(&obj_loc, dxpl_id)) < 0)
+ if((obj_id = H5O_open_by_loc(&obj_loc, dxpl_id, TRUE)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object")
/* Make callback for starting object */
@@ -2857,7 +2857,7 @@ H5O_visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
done:
if(obj_id > 0) {
- if(H5I_dec_ref(obj_id) < 0)
+ if(H5I_dec_ref(obj_id, TRUE) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "unable to close object")
} /* end if */
else if(loc_found && H5G_loc_free(&obj_loc) < 0)