summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2020-08-14 15:42:39 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2020-08-14 15:42:39 (GMT)
commit30678596f2bf9605ec510dc91adb87d1ac5a71b3 (patch)
treeff6b9baea4ca3b4033fe0bcec1aaf13834177a45 /test
parent7861784214be442052d7eaf5892e9d4b3debc7aa (diff)
downloadhdf5-30678596f2bf9605ec510dc91adb87d1ac5a71b3.zip
hdf5-30678596f2bf9605ec510dc91adb87d1ac5a71b3.tar.gz
hdf5-30678596f2bf9605ec510dc91adb87d1ac5a71b3.tar.bz2
Windows thread-safe fixes from develop
Diffstat (limited to 'test')
-rw-r--r--test/thread_id.c4
-rw-r--r--test/ttsafe_attr_vlen.c27
2 files changed, 16 insertions, 15 deletions
diff --git a/test/thread_id.c b/test/thread_id.c
index 24aef80..0c804ed 100644
--- a/test/thread_id.c
+++ b/test/thread_id.c
@@ -25,6 +25,8 @@
*/
#include "testhdf5.h"
+#if defined(H5_HAVE_THREADSAFE) && !defined(H5_HAVE_WIN_THREADS)
+
static void my_errx(int, const char *, ...) H5_ATTR_FORMAT(printf, 2, 3);
static void
@@ -40,8 +42,6 @@ my_errx(int code, const char *fmt, ...)
HDexit(code);
}
-#if defined(H5_HAVE_THREADSAFE) && !defined(H5_HAVE_WIN_THREADS)
-
#if defined(H5_HAVE_DARWIN)
typedef struct _pthread_barrierattr {
diff --git a/test/ttsafe_attr_vlen.c b/test/ttsafe_attr_vlen.c
index b07e362..43a5e9a 100644
--- a/test/ttsafe_attr_vlen.c
+++ b/test/ttsafe_attr_vlen.c
@@ -54,13 +54,13 @@ void *tts_attr_vlen_thread(void *);
void
tts_attr_vlen(void)
{
- pthread_t threads[NUM_THREADS] = {0}; /* Thread declaration */
+ H5TS_thread_t threads[NUM_THREADS] = {0}; /* Thread declaration */
hid_t fid = H5I_INVALID_HID; /* File ID */
hid_t gid = H5I_INVALID_HID; /* Group ID */
hid_t atid = H5I_INVALID_HID; /* Datatype ID for attribute */
hid_t asid = H5I_INVALID_HID; /* Dataspace ID for attribute */
hid_t aid = H5I_INVALID_HID; /* The attribute ID */
- char *string_attr = "2.0"; /* The attribute data */
+ const char *string_attr = "2.0"; /* The attribute data */
int ret; /* Return value */
int i; /* Local index variable */
@@ -106,26 +106,27 @@ tts_attr_vlen(void)
CHECK(ret, H5I_INVALID_HID, "H5Tclose");
/* Start multiple threads and execute tts_attr_vlen_thread() for each thread */
- for(i = 0; i < NUM_THREADS; i++)
- pthread_create(&threads[i], NULL, tts_attr_vlen_thread, NULL);
+ for(i = 0; i < NUM_THREADS; i++) {
+ threads[i] = H5TS_create_thread(tts_attr_vlen_thread, NULL, NULL);
+ }
/* Wait for the threads to end */
for(i = 0; i < NUM_THREADS; i++)
- pthread_join(threads[i], NULL);
+ H5TS_wait_for_thread(threads[i]);
} /* end tts_attr_vlen() */
/* Start execution for each thread */
void *
-tts_attr_vlen_thread(void *client_data)
+tts_attr_vlen_thread(void H5_ATTR_UNUSED *client_data)
{
- hid_t fid = H5I_INVALID_HID; /* File ID */
- hid_t gid = H5I_INVALID_HID; /* Group ID */
- hid_t aid = H5I_INVALID_HID; /* Attribute ID */
- hid_t atid = H5I_INVALID_HID; /* Datatype ID for the attribute */
- char *string_attr_check; /* The attribute data being read */
- char *string_attr = "2.0"; /* The expected attribute data */
- herr_t ret; /* Return value */
+ hid_t fid = H5I_INVALID_HID; /* File ID */
+ hid_t gid = H5I_INVALID_HID; /* Group ID */
+ hid_t aid = H5I_INVALID_HID; /* Attribute ID */
+ hid_t atid = H5I_INVALID_HID; /* Datatype ID for the attribute */
+ char *string_attr_check; /* The attribute data being read */
+ const char *string_attr = "2.0"; /* The expected attribute data */
+ herr_t ret; /* Return value */
/* Open the test file */
fid = H5Fopen(FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT);