diff options
Diffstat (limited to 'src/H5.c')
-rw-r--r-- | src/H5.c | 26 |
1 files changed, 17 insertions, 9 deletions
@@ -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,9 @@ H5_term_library(void) /* Mark library as closed */ H5_INIT_GLOBAL = FALSE; + /* Don't pop the API context, since it's been shut down already */ + /* H5CX_pop_special(); */ + done: #ifdef H5_HAVE_THREADSAFE H5_API_UNLOCK @@ -907,7 +916,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 +954,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 +979,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 +996,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() */ |