summaryrefslogtreecommitdiffstats
path: root/src/H5.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5.c')
-rw-r--r--src/H5.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/H5.c b/src/H5.c
index b8fd885..552330d 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -21,6 +21,7 @@
/***********/
#include "H5private.h" /* Generic Functions */
#include "H5ACprivate.h" /* Metadata cache */
+#include "H5CXprivate.h" /* API Contexts */
#include "H5Dprivate.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
#include "H5FLprivate.h" /* Free lists */
@@ -30,7 +31,6 @@
#include "H5Pprivate.h" /* Property lists */
#include "H5SLprivate.h" /* Skip lists */
#include "H5Tprivate.h" /* Datatypes */
-#include "H5FSprivate.h" /* File free space */
/****************/
/* Local Macros */
@@ -224,7 +224,7 @@ H5_init_library(void)
if(H5L_init() < 0)
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")
+ HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize FS interface")
/* Debugging? */
H5_debug_mask("-all");
@@ -267,6 +267,9 @@ H5_term_library(void)
/* Indicate that the library is being shut down */
H5_TERM_GLOBAL = TRUE;
+ /* Push the API context without checking for errors */
+ H5CX_push_special();
+
/* Check if we should display error output */
(void)H5Eget_auto2(H5E_DEFAULT, &func, NULL);
@@ -351,9 +354,12 @@ H5_term_library(void)
/* Don't shut down the skip list code until everything that uses it is down */
if(pending == 0)
pending += DOWN(SL);
- /* Don't shut down the free list code until _everything_ else is down */
+ /* Don't shut down the free list code until everything that uses it is down */
if(pending == 0)
pending += DOWN(FL);
+ /* Don't shut down the API context code until _everything_ else is down */
+ if(pending == 0)
+ pending += DOWN(CX);
} /* end if */
} while(pending && ntries++ < 100);
@@ -409,6 +415,8 @@ H5_term_library(void)
/* Mark library as closed */
H5_INIT_GLOBAL = FALSE;
+ /* Don't pop the API context (i.e. H5CX_pop), since it's been shut down already */
+
done:
#ifdef H5_HAVE_THREADSAFE
H5_API_UNLOCK
@@ -907,7 +915,7 @@ H5allocate_memory(size_t size, hbool_t clear)
else
ret_value = H5MM_malloc(size);
- FUNC_LEAVE_API(ret_value)
+ FUNC_LEAVE_API_NOINIT(ret_value)
} /* end H5allocate_memory() */
@@ -945,7 +953,7 @@ H5resize_memory(void *mem, size_t size)
ret_value = H5MM_realloc(mem, size);
- FUNC_LEAVE_API(ret_value)
+ FUNC_LEAVE_API_NOINIT(ret_value)
} /* end H5resize_memory() */
@@ -970,7 +978,7 @@ H5free_memory(void *mem)
/* At this time, it is impossible for this to fail. */
H5MM_xfree(mem);
- FUNC_LEAVE_API(SUCCEED)
+ FUNC_LEAVE_API_NOINIT(SUCCEED)
} /* end H5free_memory() */
@@ -987,20 +995,19 @@ H5free_memory(void *mem)
herr_t
H5is_library_threadsafe(hbool_t *is_ts)
{
- herr_t ret_value = SUCCEED;
-
FUNC_ENTER_API_NOINIT
H5TRACE1("e", "*b", is_ts);
HDassert(is_ts);
+ /* At this time, it is impossible for this to fail. */
#ifdef H5_HAVE_THREADSAFE
*is_ts = TRUE;
#else /* H5_HAVE_THREADSAFE */
*is_ts = FALSE;
#endif /* H5_HAVE_THREADSAFE */
- FUNC_LEAVE_API(ret_value)
+ FUNC_LEAVE_API_NOINIT(SUCCEED)
} /* end H5is_library_threadsafe() */