summaryrefslogtreecommitdiffstats
path: root/src/H5.c
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2015-08-26 17:05:57 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2015-08-26 17:05:57 (GMT)
commit606c16e11126bd908e673abefd4f0b7e91562d7f (patch)
treeb00d04aa9badff7a5c747a846b11c0e354a40596 /src/H5.c
parent6635d4c003caf15aadc16b0453d71ca1b0e8ca1f (diff)
downloadhdf5-606c16e11126bd908e673abefd4f0b7e91562d7f.zip
hdf5-606c16e11126bd908e673abefd4f0b7e91562d7f.tar.gz
hdf5-606c16e11126bd908e673abefd4f0b7e91562d7f.tar.bz2
[svn-r27587] Added a new API call (H5is_library_threadsafe) to the library. This call can
be used to determine at runtime if the library was built with thread-safety. Fixes HDFFV-9496 Tested on: h5committest
Diffstat (limited to 'src/H5.c')
-rw-r--r--src/H5.c48
1 files changed, 39 insertions, 9 deletions
diff --git a/src/H5.c b/src/H5.c
index 3d4512f..8563545 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -21,17 +21,17 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5ACprivate.h" /* Metadata cache */
-#include "H5Dprivate.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5FLprivate.h" /* Free lists */
-#include "H5Lprivate.h" /* Links */
+#include "H5private.h" /* Generic Functions */
+#include "H5ACprivate.h" /* Metadata cache */
+#include "H5Dprivate.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FLprivate.h" /* Free lists */
+#include "H5Lprivate.h" /* Links */
#include "H5MMprivate.h" /* Memory management */
-#include "H5Pprivate.h" /* Property lists */
-#include "H5Tprivate.h" /* Datatypes */
+#include "H5Pprivate.h" /* Property lists */
#include "H5SLprivate.h" /* Skip lists */
-
+#include "H5Tprivate.h" /* Datatypes */
+#include "H5TSprivate.h" /* Thread safety */
/****************/
/* Local Macros */
@@ -973,6 +973,36 @@ H5free_memory(void *mem)
} /* end H5free_memory() */
+/*-------------------------------------------------------------------------
+ * Function: H5is_library_threadsafe
+ *
+ * Purpose: Checks to see if the library was built with thread-safety
+ * enabled.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+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);
+
+#ifdef H5_HAVE_THREADSAFE
+ *is_ts = TRUE;
+#else /* H5_HAVE_THREADSAFE */
+ *is_ts = FALSE;
+#endif /* H5_HAVE_THREADSAFE */
+
+ FUNC_LEAVE_API(ret_value)
+} /* end H5is_library_threadsafe() */
+
+
#if defined(H5_HAVE_THREADSAFE) && defined(H5_BUILT_AS_DYNAMIC_LIB) \
&& defined(H5_HAVE_WIN32_API) && defined(H5_HAVE_WIN_THREADS)
/*-------------------------------------------------------------------------