summaryrefslogtreecommitdiffstats
path: root/src/H5Dint.c
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2008-08-19 16:36:55 (GMT)
committerNeil Fortner <nfortne2@hdfgroup.org>2008-08-19 16:36:55 (GMT)
commit4b141cbc6a55a02b3191db75ef40450d4bc9d92d (patch)
treeca07875ee7b217123e5c330671a38da5bc33c2ae /src/H5Dint.c
parente660080290417487a8caf2b14055eda6b39e9f6e (diff)
downloadhdf5-4b141cbc6a55a02b3191db75ef40450d4bc9d92d.zip
hdf5-4b141cbc6a55a02b3191db75ef40450d4bc9d92d.tar.gz
hdf5-4b141cbc6a55a02b3191db75ef40450d4bc9d92d.tar.bz2
[svn-r15486] 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/H5Dint.c')
-rw-r--r--src/H5Dint.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/H5Dint.c b/src/H5Dint.c
index 162a14f..4723b17 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -241,7 +241,7 @@ H5D_term_interface(void)
*
* QAK - 5/13/03
*/
- H5I_clear_type(H5I_DATASET, TRUE);
+ H5I_clear_type(H5I_DATASET, TRUE, FALSE);
} else {
H5I_dec_type_ref(H5I_DATASET);
H5_interface_initialize_g = 0;
@@ -535,7 +535,7 @@ H5D_new(hid_t dcpl_id, hbool_t creating, hbool_t vl_type)
* don't bother to copy it, just increment the reference count
*/
if(!vl_type && creating && dcpl_id == H5P_DATASET_CREATE_DEFAULT) {
- if(H5I_inc_ref(dcpl_id) < 0)
+ if(H5I_inc_ref(dcpl_id, FALSE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINC, NULL, "Can't increment default DCPL ID")
new_dset->dcpl_id = dcpl_id;
} /* end if */
@@ -544,7 +544,7 @@ H5D_new(hid_t dcpl_id, hbool_t creating, hbool_t vl_type)
if(NULL == (plist = (H5P_genplist_t *)H5I_object(dcpl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a property list")
- new_dset->dcpl_id = H5P_copy_plist(plist);
+ new_dset->dcpl_id = H5P_copy_plist(plist, FALSE);
} /* end else */
/* Set return value */
@@ -554,7 +554,7 @@ done:
if(ret_value == NULL)
if(new_dset != NULL) {
if(new_dset->dcpl_id != 0)
- (void)H5I_dec_ref(new_dset->dcpl_id);
+ (void)H5I_dec_ref(new_dset->dcpl_id, FALSE);
H5FL_FREE(H5D_shared_t, new_dset);
} /* end if */
@@ -618,12 +618,12 @@ H5D_init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set latest version of datatype")
/* Get a datatype ID for the dataset's datatype */
- if((dset->shared->type_id = H5I_register(H5I_DATATYPE, dset->shared->type)) < 0)
+ if((dset->shared->type_id = H5I_register(H5I_DATATYPE, dset->shared->type, FALSE)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register type")
} /* end if */
/* Not a custom datatype, just use it directly */
else {
- if(H5I_inc_ref(type_id) < 0)
+ if(H5I_inc_ref(type_id, FALSE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINC, FAIL, "Can't increment datatype ID")
/* Use existing datatype */
@@ -1161,7 +1161,7 @@ done:
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, NULL, "unable to release dataspace")
} /* end if */
if(new_dset->shared->type) {
- if(H5I_dec_ref(new_dset->shared->type_id) < 0)
+ if(H5I_dec_ref(new_dset->shared->type_id, FALSE) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, NULL, "unable to release datatype")
} /* end if */
if(H5F_addr_defined(new_dset->oloc.addr)) {
@@ -1173,7 +1173,7 @@ done:
} /* end if */
} /* end if */
if(new_dset->shared->dcpl_id != 0) {
- if(H5I_dec_ref(new_dset->shared->dcpl_id) < 0)
+ if(H5I_dec_ref(new_dset->shared->dcpl_id, FALSE) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "unable to decrement ref count on property list")
} /* end if */
H5FL_FREE(H5D_shared_t, new_dset->shared);
@@ -1327,7 +1327,7 @@ H5D_open_oid(H5D_t *dataset, hid_t dxpl_id)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to load space info from dataset header")
/* Get a datatype ID for the dataset's datatype */
- if((dataset->shared->type_id = H5I_register(H5I_DATATYPE, dataset->shared->type)) < 0)
+ if((dataset->shared->type_id = H5I_register(H5I_DATATYPE, dataset->shared->type, FALSE)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register type")
/* Get dataset creation property list object */
@@ -1508,7 +1508,7 @@ done:
} /* end if */
if(dataset->shared->type) {
if(dataset->shared->type_id > 0) {
- if(H5I_dec_ref(dataset->shared->type_id) < 0)
+ if(H5I_dec_ref(dataset->shared->type_id, FALSE) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release datatype")
} /* end if */
else {
@@ -1612,8 +1612,8 @@ H5D_close(H5D_t *dataset)
* Release datatype, dataspace and creation property list -- there isn't
* much we can do if one of these fails, so we just continue.
*/
- free_failed = (H5I_dec_ref(dataset->shared->type_id) < 0 || H5S_close(dataset->shared->space) < 0 ||
- H5I_dec_ref(dataset->shared->dcpl_id) < 0);
+ free_failed = (H5I_dec_ref(dataset->shared->type_id, FALSE) < 0 || H5S_close(dataset->shared->space) < 0 ||
+ H5I_dec_ref(dataset->shared->dcpl_id, FALSE) < 0);
/* Remove the dataset from the list of opened objects in the file */
if(H5FO_top_decr(dataset->oloc.file, dataset->oloc.addr) < 0)