summaryrefslogtreecommitdiffstats
path: root/src/H5.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5.c')
-rw-r--r--src/H5.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/H5.c b/src/H5.c
index e7514b4..7efd4f0 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -14,6 +14,7 @@
/****************/
/* Module Setup */
/****************/
+#include "H5module.h" /* This source code file is part of the H5 module */
/***********/
/* Headers */
@@ -55,6 +56,9 @@ static int H5__mpi_delete_cb(MPI_Comm comm, int keyval, void *attr_val, int *fla
/* Package Variables */
/*********************/
+/* Package initialization variable */
+hbool_t H5_PKG_INIT_VAR = FALSE;
+
/*****************************/
/* Library Private Variables */
/*****************************/
@@ -85,6 +89,33 @@ H5_debug_t H5_debug_g; /* debugging info */
/*******************/
/*--------------------------------------------------------------------------
+NAME
+ H5__init_package -- Initialize interface-specific information
+USAGE
+ herr_t H5__init_package()
+RETURNS
+ Non-negative on success/Negative on failure
+DESCRIPTION
+ Initializes any interface-specific data or routines.
+--------------------------------------------------------------------------*/
+herr_t
+H5__init_package(void)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ /* Run the library initialization routine, if it hasn't already ran */
+ if (!H5_INIT_GLOBAL && !H5_TERM_GLOBAL) { \
+ if (H5_init_library() < 0)
+ HGOTO_ERROR(H5E_LIB, H5E_CANTINIT, FAIL, "unable to initialize library")
+ } /* end if */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5__init_package() */
+
+/*--------------------------------------------------------------------------
* NAME
* H5_init_library -- Initialize library-global information
* USAGE
@@ -103,6 +134,11 @@ H5_init_library(void)
{
herr_t ret_value = SUCCEED;
+ /* Set the 'library initialized' flag as early as possible, to avoid
+ * possible re-entrancy.
+ */
+ H5_INIT_GLOBAL = TRUE; \
+
FUNC_ENTER_NOAPI(FAIL)
#ifdef H5_HAVE_PARALLEL