diff options
author | Mike McGreevy <mamcgree@hdfgroup.org> | 2010-09-10 16:15:57 (GMT) |
---|---|---|
committer | Mike McGreevy <mamcgree@hdfgroup.org> | 2010-09-10 16:15:57 (GMT) |
commit | 2d9a70085c38816df68a1b2cfce59c05853e3c4a (patch) | |
tree | 4fd2b91f1dcf8291ab6654caa8a68eef46aff824 /src/H5private.h | |
parent | a8646632e8f76b729c141d0570700bae2fa884e9 (diff) | |
download | hdf5-2d9a70085c38816df68a1b2cfce59c05853e3c4a.zip hdf5-2d9a70085c38816df68a1b2cfce59c05853e3c4a.tar.gz hdf5-2d9a70085c38816df68a1b2cfce59c05853e3c4a.tar.bz2 |
[svn-r19368] Purpose:
Add windows threads support to HDF5.
Description:
Added calls to the windows threads library to the H5TS layer, and wrapped
most calls to either pthreads or windows threads library with portable
H5TS-style defines. Modified tests to use portable function definitions
as well.
This can be configured via CMake with the HDF5_ENABLE_THREADSAFE
option, and should work on windows vista and later operating systems.
Tested:
h5committest, plus threadsafe with pthreads on jam and amani,
and tested on a Windows Vista VM with threadsafe using windows threads.
Diffstat (limited to 'src/H5private.h')
-rw-r--r-- | src/H5private.h | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/H5private.h b/src/H5private.h index 47dded7..4f67326 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -30,8 +30,12 @@ /* include the pthread header */ #ifdef H5_HAVE_THREADSAFE +#ifdef H5_HAVE_PTHREAD_H #include <pthread.h> -#endif +#else /* H5_HAVE_PTHREAD_H */ +#define H5_HAVE_WIN_THREADS +#endif /* H5_HAVE_PTHREAD_H */ +#endif /* H5_HAVE_THREADSAFE */ /* * Include ANSI-C header files. @@ -1660,8 +1664,15 @@ typedef struct H5_api_struct { #define H5_INIT_GLOBAL H5_g.H5_libinit_g /* Macro for first thread initialization */ -#define H5_FIRST_THREAD_INIT \ - pthread_once(&H5TS_first_init_g, H5TS_first_thread_init); +#ifdef H5_HAVE_WIN_THREADS +#define H5_FIRST_THREAD_INIT \ + if (!H5_INIT_GLOBAL) \ + InitOnceExecuteOnce(&H5TS_first_init_g, H5TS_win32_first_thread_init, NULL, NULL); +#else +#define H5_FIRST_THREAD_INIT \ + if (!H5_INIT_GLOBAL) \ + pthread_once(&H5TS_first_init_g, H5TS_first_thread_init); +#endif /* Macros for threadsafe HDF-5 Phase I locks */ #define H5_API_LOCK \ |