diff options
author | Mike McGreevy <mamcgree@hdfgroup.org> | 2010-09-10 16:15:34 (GMT) |
---|---|---|
committer | Mike McGreevy <mamcgree@hdfgroup.org> | 2010-09-10 16:15:34 (GMT) |
commit | b7c2d18029df6d724e44b74c8f49bb7aa1e2f02b (patch) | |
tree | c3dd326b9b8ed4746b57165165713ae9b046c62b /src/H5private.h | |
parent | 47c792faa033c4c149b2c5d4dd0e70e4f2b0e3d2 (diff) | |
download | hdf5-b7c2d18029df6d724e44b74c8f49bb7aa1e2f02b.zip hdf5-b7c2d18029df6d724e44b74c8f49bb7aa1e2f02b.tar.gz hdf5-b7c2d18029df6d724e44b74c8f49bb7aa1e2f02b.tar.bz2 |
[svn-r19367] 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 3875fb3..cc36d16 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. @@ -1666,8 +1670,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 \ |