summaryrefslogtreecommitdiffstats
path: root/src
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
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')
-rw-r--r--src/H5.c48
-rw-r--r--src/H5public.h4
2 files changed, 42 insertions, 10 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)
/*-------------------------------------------------------------------------
diff --git a/src/H5public.h b/src/H5public.h
index b9b4dd7..8c7da05 100644
--- a/src/H5public.h
+++ b/src/H5public.h
@@ -331,6 +331,7 @@ H5_DLL herr_t H5get_libversion(unsigned *majnum, unsigned *minnum,
unsigned *relnum);
H5_DLL herr_t H5check_version(unsigned majnum, unsigned minnum,
unsigned relnum);
+H5_DLL herr_t H5is_library_threadsafe(hbool_t *is_ts);
H5_DLL herr_t H5free_memory(void *mem);
H5_DLL void *H5allocate_memory(size_t size, hbool_t clear);
H5_DLL void *H5resize_memory(void *mem, size_t size);
@@ -338,5 +339,6 @@ H5_DLL void *H5resize_memory(void *mem, size_t size);
#ifdef __cplusplus
}
#endif
-#endif
+#endif /* _H5public_H */
+