summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/thread_id.c4
-rw-r--r--test/trefer.c50
-rw-r--r--test/ttsafe_attr_vlen.c27
3 files changed, 42 insertions, 39 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/trefer.c b/test/trefer.c
index b90ec45..4bf5c17 100644
--- a/test/trefer.c
+++ b/test/trefer.c
@@ -1135,11 +1135,11 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
hsize_t *coords; /* Coordinate buffer */
hsize_t low[SPACE2_RANK]; /* Selection bounds */
hsize_t high[SPACE2_RANK]; /* Selection bounds */
- H5R_ref_t *wbuf, /* buffer to write to disk */
- *rbuf; /* buffer read from disk */
+ H5R_ref_t *wbuf = NULL, /* buffer to write to disk */
+ *rbuf = NULL; /* buffer read from disk */
H5R_ref_t nvrbuf[3]={{{{0}}},{{{101}}},{{{255}}}}; /* buffer with non-valid refs */
- uint8_t *dwbuf, /* Buffer for writing numeric data to disk */
- *drbuf; /* Buffer for reading numeric data from disk */
+ uint8_t *dwbuf = NULL, /* Buffer for writing numeric data to disk */
+ *drbuf = NULL; /* Buffer for reading numeric data from disk */
uint8_t *tu8; /* Temporary pointer to uint8 data */
H5O_type_t obj_type; /* Type of object */
int i, j; /* Counters */
@@ -1537,13 +1537,14 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
CHECK(ret, FAIL, "H5Rdestroy");
}
- /* Free memory buffers */
- HDfree(wbuf);
- HDfree(rbuf);
- HDfree(dwbuf);
- HDfree(drbuf);
-
}
+
+ /* Free memory buffers */
+ HDfree(wbuf);
+ HDfree(rbuf);
+ HDfree(dwbuf);
+ HDfree(drbuf);
+
} /* test_reference_region() */
/****************************************************************
@@ -1576,10 +1577,10 @@ test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high)
hsize_t *coords; /* Coordinate buffer */
hsize_t low[SPACE3_RANK]; /* Selection bounds */
hsize_t high[SPACE3_RANK]; /* Selection bounds */
- H5R_ref_t *wbuf, /* buffer to write to disk */
- *rbuf; /* buffer read from disk */
- uint8_t *dwbuf, /* Buffer for writing numeric data to disk */
- *drbuf; /* Buffer for reading numeric data from disk */
+ H5R_ref_t *wbuf = NULL, /* buffer to write to disk */
+ *rbuf = NULL; /* buffer read from disk */
+ uint8_t *dwbuf = NULL, /* Buffer for writing numeric data to disk */
+ *drbuf = NULL; /* Buffer for reading numeric data from disk */
uint8_t *tu8; /* Temporary pointer to uint8 data */
H5O_type_t obj_type; /* Object type */
int i; /* Counter */
@@ -1876,13 +1877,14 @@ test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high)
CHECK(ret, FAIL, "H5Rdestroy");
}
- /* Free memory buffers */
- HDfree(wbuf);
- HDfree(rbuf);
- HDfree(dwbuf);
- HDfree(drbuf);
-
}
+
+ /* Free memory buffers */
+ HDfree(wbuf);
+ HDfree(rbuf);
+ HDfree(dwbuf);
+ HDfree(drbuf);
+
} /* test_reference_region_1D() */
/****************************************************************
@@ -2718,10 +2720,10 @@ test_reference_compat_conv(void)
hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
hsize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */
- hobj_ref_t *wbuf_obj; /* Buffer to write to disk */
- H5R_ref_t *rbuf_obj; /* Buffer read from disk */
- hdset_reg_ref_t *wbuf_reg; /* Buffer to write to disk */
- H5R_ref_t *rbuf_reg; /* Buffer read from disk */
+ hobj_ref_t *wbuf_obj = NULL; /* Buffer to write to disk */
+ H5R_ref_t *rbuf_obj = NULL; /* Buffer read from disk */
+ hdset_reg_ref_t *wbuf_reg = NULL; /* Buffer to write to disk */
+ H5R_ref_t *rbuf_reg = NULL; /* Buffer read from disk */
H5O_type_t obj_type; /* Object type */
herr_t ret; /* Generic return value */
unsigned int i; /* Counter */
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);