summaryrefslogtreecommitdiffstats
path: root/src/H5R.c
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2017-07-03 19:54:14 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2017-07-03 19:54:14 (GMT)
commit76b9a0e7eff83db3ed69080f62b95ae568f7129e (patch)
tree10e414c609bbc1c37862675a09a8c2c2e4d89289 /src/H5R.c
parentd342358a3b1acd5712b3c136c3985db414f6f673 (diff)
downloadhdf5-76b9a0e7eff83db3ed69080f62b95ae568f7129e.zip
hdf5-76b9a0e7eff83db3ed69080f62b95ae568f7129e.tar.gz
hdf5-76b9a0e7eff83db3ed69080f62b95ae568f7129e.tar.bz2
* Reverted removal of H5I_REFERENCE to avoid breaking binary
compatibility. * Added a quick H5I_REFERENCE smoke check to test_misc19() in tmisc.c.
Diffstat (limited to 'src/H5R.c')
-rw-r--r--src/H5R.c76
1 files changed, 73 insertions, 3 deletions
diff --git a/src/H5R.c b/src/H5R.c
index dc012e8..c2a10ce 100644
--- a/src/H5R.c
+++ b/src/H5R.c
@@ -71,6 +71,17 @@ hbool_t H5_PKG_INIT_VAR = FALSE;
/* Local Variables */
/*******************/
+/* Reference ID class */
+static const H5I_class_t H5I_REFERENCE_CLS[1] = {{
+ H5I_REFERENCE, /* ID class value */
+ 0, /* Class flags */
+ 0, /* # of reserved IDs for class */
+ NULL /* Callback routine for closing objects of this class */
+}};
+
+/* Flag indicating "top" of interface has been initialized */
+static hbool_t H5R_top_package_initialize_s = FALSE;
+
/*--------------------------------------------------------------------------
@@ -92,6 +103,13 @@ H5R__init_package(void)
FUNC_ENTER_NOAPI_NOINIT
+/* Initialize the atom group for the file IDs */
+ if(H5I_register_type(H5I_REFERENCE_CLS) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable to initialize interface")
+
+ /* Mark "top" of interface as initialized, too */
+ H5R_top_package_initialize_s = TRUE;
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5R__init_package() */
@@ -99,6 +117,46 @@ done:
/*--------------------------------------------------------------------------
NAME
+ H5R_top_term_package
+ PURPOSE
+ Terminate various H5R objects
+ USAGE
+ void H5R_top_term_package()
+ RETURNS
+ void
+ DESCRIPTION
+ Release IDs for the atom group, deferring full interface shutdown
+ until later (in H5R_term_package).
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ Can't report errors...
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int
+H5R_top_term_package(void)
+{
+ int n = 0;
+
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ if(H5R_top_package_initialize_s) {
+ if(H5I_nmembers(H5I_REFERENCE) > 0) {
+ (void)H5I_clear_type(H5I_REFERENCE, FALSE, FALSE);
+ n++; /*H5I*/
+ } /* end if */
+
+ /* Mark closed */
+ if(0 == n)
+ H5R_top_package_initialize_s = FALSE;
+ } /* end if */
+
+ FUNC_LEAVE_NOAPI(n)
+} /* end H5R__init_package() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
H5R_term_package
PURPOSE
Terminate various H5R objects
@@ -120,12 +178,24 @@ done:
int
H5R_term_package(void)
{
+ int n = 0;
+
FUNC_ENTER_NOAPI_NOINIT_NOERR
- if(H5_PKG_INIT_VAR)
- H5_PKG_INIT_VAR = FALSE;
+ if(H5_PKG_INIT_VAR) {
+ /* Sanity checks */
+ HDassert(0 == H5I_nmembers(H5I_REFERENCE));
+ HDassert(FALSE == H5R_top_package_initialize_s);
+
+ /* Destroy the reference id group */
+ n += (H5I_dec_type_ref(H5I_REFERENCE) > 0);
+
+ /* Mark closed */
+ if(0 == n)
+ H5_PKG_INIT_VAR = FALSE;
+ }
- FUNC_LEAVE_NOAPI(0)
+ FUNC_LEAVE_NOAPI(n)
} /* end H5R_term_package() */