summaryrefslogtreecommitdiffstats
path: root/src/H5TS.c
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2011-09-12 14:02:44 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2011-09-12 14:02:44 (GMT)
commit9115bab9e36d72bb395820e38b6bee4c99dcd78c (patch)
tree2fa4450bca7e33a1466fa2be8afb59a9370b8b64 /src/H5TS.c
parentee039a03b9fca394251bd1b543df3aa819b13d51 (diff)
downloadhdf5-9115bab9e36d72bb395820e38b6bee4c99dcd78c.zip
hdf5-9115bab9e36d72bb395820e38b6bee4c99dcd78c.tar.gz
hdf5-9115bab9e36d72bb395820e38b6bee4c99dcd78c.tar.bz2
[svn-r21376] JIRA-HDFFV-2748: Relplace WIN32 macros in source. New H5_HAVE_WIN32_API and H5_HAVE_VISUAL_STUDIO defines only need to be set on windows. Autotools configure is not affected.
Trunk passed for a week and cmake branch has been in place > 3 weeks. Tested: local linux
Diffstat (limited to 'src/H5TS.c')
-rw-r--r--src/H5TS.c42
1 files changed, 24 insertions, 18 deletions
diff --git a/src/H5TS.c b/src/H5TS.c
index 480bc2d..97a743f 100644
--- a/src/H5TS.c
+++ b/src/H5TS.c
@@ -14,9 +14,9 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* private headers */
-#include "H5private.h" /*library */
-#include "H5Eprivate.h" /*error handling */
-#include "H5MMprivate.h" /*memory management functions */
+#include "H5private.h" /*library */
+#include "H5Eprivate.h" /*error handling */
+#include "H5MMprivate.h" /*memory management functions */
#ifdef H5_HAVE_THREADSAFE
@@ -126,6 +126,12 @@ void
H5TS_pthread_first_thread_init(void)
{
H5_g.H5_libinit_g = FALSE;
+
+#ifdef H5_HAVE_WIN32_API
+# ifdef PTW32_STATIC_LIB
+ pthread_win32_process_attach_np();
+# endif
+#endif
/* initialize global API mutex lock */
pthread_mutex_init(&H5_g.init_lock.atomic_lock, NULL);
@@ -171,7 +177,7 @@ H5TS_pthread_first_thread_init(void)
herr_t
H5TS_mutex_lock(H5TS_mutex_t *mutex)
{
-#ifdef H5_HAVE_WIN_THREADS
+#ifdef H5_HAVE_WIN_THREADS
EnterCriticalSection( &mutex->CriticalSection);
return 0;
#else /* H5_HAVE_WIN_THREADS */
@@ -226,7 +232,7 @@ H5TS_mutex_lock(H5TS_mutex_t *mutex)
herr_t
H5TS_mutex_unlock(H5TS_mutex_t *mutex)
{
-#ifdef H5_HAVE_WIN_THREADS
+#ifdef H5_HAVE_WIN_THREADS
/* Releases ownership of the specified critical section object. */
LeaveCriticalSection(&mutex->CriticalSection);
return 0;
@@ -285,7 +291,7 @@ H5TS_mutex_unlock(H5TS_mutex_t *mutex)
herr_t
H5TS_cancel_count_inc(void)
{
-#ifdef H5_HAVE_WIN_THREADS
+#ifdef H5_HAVE_WIN_THREADS
/* unsupported; just return 0 */
return SUCCEED;
#else /* H5_HAVE_WIN_THREADS */
@@ -296,25 +302,25 @@ H5TS_cancel_count_inc(void)
if (!cancel_counter) {
/*
- * First time thread calls library - create new counter and associate
+ * First time thread calls library - create new counter and associate
* with key
*/
- cancel_counter = (H5TS_cancel_t *)H5MM_calloc(sizeof(H5TS_cancel_t));
+ cancel_counter = (H5TS_cancel_t *)H5MM_calloc(sizeof(H5TS_cancel_t));
- if (!cancel_counter) {
- H5E_push_stack(NULL, "H5TS_cancel_count_inc",
- __FILE__, __LINE__, H5E_ERR_CLS_g, H5E_RESOURCE, H5E_NOSPACE, "memory allocation failed");
- return FAIL;
- }
+ if (!cancel_counter) {
+ H5E_push_stack(NULL, "H5TS_cancel_count_inc",
+ __FILE__, __LINE__, H5E_ERR_CLS_g, H5E_RESOURCE, H5E_NOSPACE, "memory allocation failed");
+ return FAIL;
+ }
ret_value = pthread_setspecific(H5TS_cancel_key_g,
- (void *)cancel_counter);
+ (void *)cancel_counter);
}
if (cancel_counter->cancel_count == 0)
/* thread entering library */
ret_value = pthread_setcancelstate(PTHREAD_CANCEL_DISABLE,
- &cancel_counter->previous_state);
+ &cancel_counter->previous_state);
++cancel_counter->cancel_count;
@@ -352,7 +358,7 @@ H5TS_cancel_count_inc(void)
herr_t
H5TS_cancel_count_dec(void)
{
-#ifdef H5_HAVE_WIN_THREADS
+#ifdef H5_HAVE_WIN_THREADS
/* unsupported; will just return 0 */
return SUCCEED;
#else /* H5_HAVE_WIN_THREADS */
@@ -391,7 +397,7 @@ H5TS_create_thread(void * func, H5TS_attr_t * attr, void*udata)
{
H5TS_thread_t ret_value;
-#ifdef H5_HAVE_WIN_THREADS
+#ifdef H5_HAVE_WIN_THREADS
ret_value = CreateThread(NULL, 0, func, udata, 0, NULL);
@@ -405,4 +411,4 @@ H5TS_create_thread(void * func, H5TS_attr_t * attr, void*udata)
} /* H5TS_create_thread */
-#endif /* H5_HAVE_THREADSAFE */
+#endif /* H5_HAVE_THREADSAFE */