summaryrefslogtreecommitdiffstats
path: root/src/H5.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5.c')
-rw-r--r--src/H5.c48
1 files changed, 31 insertions, 17 deletions
diff --git a/src/H5.c b/src/H5.c
index e5583be..bec41da 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -254,6 +254,8 @@ H5_init_library(void)
* It might not be initialized during normal file open.
* When the application does not close the file, routines in the module might
* be called via H5_term_library() when shutting down the file.
+ * The dataspace interface needs to be initialized so that future IDs for
+ * dataspaces work.
*/
if (H5E_init() < 0)
HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize error interface")
@@ -267,6 +269,8 @@ H5_init_library(void)
HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize link interface")
if (H5FS_init() < 0)
HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize FS interface")
+ if (H5S_init() < 0)
+ HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize dataspace interface")
/* Finish initializing interfaces that depend on the interfaces above */
if (H5VL_init_phase2() < 0)
@@ -357,21 +361,31 @@ H5_term_library(void)
/* Try to organize these so the "higher" level components get shut
* down before "lower" level components that they might rely on. -QAK
*/
- pending += DOWN(L);
- /* Close the "top" of various interfaces (IDs, etc) but don't shut
- * down the whole interface yet, so that the object header messages
- * get serialized correctly for entries in the metadata cache and the
- * symbol table entry in the superblock gets serialized correctly, etc.
- * all of which is performed in the 'F' shutdown.
+ /* Close the event sets first, so that all asynchronous operations
+ * complete before anything else attempts to shut down.
*/
- pending += DOWN(A_top);
- pending += DOWN(D_top);
- pending += DOWN(G_top);
- pending += DOWN(M_top);
- pending += DOWN(R_top);
- pending += DOWN(S_top);
- pending += DOWN(T_top);
+ pending += DOWN(ES);
+
+ /* Close down the user-facing interfaces, after the event sets */
+ if (pending == 0) {
+ /* Close the interfaces dependent on others */
+ pending += DOWN(L);
+
+ /* Close the "top" of various interfaces (IDs, etc) but don't shut
+ * down the whole interface yet, so that the object header messages
+ * get serialized correctly for entries in the metadata cache and the
+ * symbol table entry in the superblock gets serialized correctly, etc.
+ * all of which is performed in the 'F' shutdown.
+ */
+ pending += DOWN(A_top);
+ pending += DOWN(D_top);
+ pending += DOWN(G_top);
+ pending += DOWN(M_top);
+ pending += DOWN(R_top);
+ pending += DOWN(S_top);
+ pending += DOWN(T_top);
+ } /* end if */
/* Don't shut down the file code until objects in files are shut down */
if (pending == 0)
@@ -1183,12 +1197,12 @@ H5free_memory(void *mem)
herr_t
H5is_library_threadsafe(hbool_t *is_ts /*out*/)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
H5TRACE1("e", "x", is_ts);
- if(is_ts) {
+ if (is_ts) {
#ifdef H5_HAVE_THREADSAFE
*is_ts = TRUE;
#else /* H5_HAVE_THREADSAFE */
@@ -1218,14 +1232,14 @@ H5is_library_threadsafe(hbool_t *is_ts /*out*/)
herr_t
H5is_library_terminating(hbool_t *is_terminating /*out*/)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
H5TRACE1("e", "x", is_terminating);
HDassert(is_terminating);
- if(is_terminating)
+ if (is_terminating)
*is_terminating = H5_TERM_GLOBAL;
else
ret_value = FAIL;