summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2005-08-20 15:45:13 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2005-08-20 15:45:13 (GMT)
commiteec442a8f6d26f66eda16bc144d396e90dd06516 (patch)
tree8dcf9d66af2d2dd83a71fecfdf704e18814462e4
parent20c9e7bc0600d4662f1a465dd696e08b9412d89e (diff)
downloadhdf5-eec442a8f6d26f66eda16bc144d396e90dd06516.zip
hdf5-eec442a8f6d26f66eda16bc144d396e90dd06516.tar.gz
hdf5-eec442a8f6d26f66eda16bc144d396e90dd06516.tar.bz2
[svn-r11276] Purpose:
Code cleanup/bug fix Description: Add missing files to manifest Remove C++ style single-line comment from recent checkin and also re-indent in a few places. Platforms tested: FreeBSD 4.11 (sleipnir) w/thread-safe Not configured w/h5committest
-rw-r--r--MANIFEST16
-rw-r--r--test/ttsafe_acreate.c17
-rw-r--r--test/ttsafe_cancel.c76
-rw-r--r--test/ttsafe_error.c42
4 files changed, 79 insertions, 72 deletions
diff --git a/MANIFEST b/MANIFEST
index 8a666c0..8dfe824 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -343,22 +343,23 @@ a------------------------------------------------------------------------------
./perform/pio_timer.h
./perform/zip_perf.c
+./release_docs/HISTORY.txt
./release_docs/INSTALL
+./release_docs/INSTALL_Cygwin.txt
./release_docs/INSTALL_TFLOPS
./release_docs/INSTALL_VFL
-./release_docs/INSTALL_parallel
+./release_docs/INSTALL_Windows.html
./release_docs/INSTALL_Windows.txt
+./release_docs/INSTALL_Windows_From_Command_Line.html
./release_docs/INSTALL_Windows_From_Command_Line.txt
+./release_docs/INSTALL_Windows_Short_Intel.htm
./release_docs/INSTALL_Windows_Short_INTEL.TXT
-./release_docs/INSTALL_Windows_Short_MSVS6.0.TXT
-./release_docs/INSTALL_Windows_Short_NET.TXT
-./release_docs/INSTALL_Windows.html
-./release_docs/INSTALL_Windows_From_Command_Line.html
./release_docs/INSTALL_Windows_Short_MSVS6.0.htm
+./release_docs/INSTALL_Windows_Short_MSVS6.0.TXT
./release_docs/INSTALL_Windows_Short_Net.htm
-./release_docs/INSTALL_Windows_Short_Intel.htm
+./release_docs/INSTALL_Windows_Short_NET.TXT
./release_docs/INSTALL_codewarrior.txt
-./release_docs/HISTORY.txt
+./release_docs/INSTALL_parallel
./release_docs/RELEASE.txt
./src/.indent.pro _DO_NOT_DISTRIBUTE_
@@ -1506,6 +1507,7 @@ a------------------------------------------------------------------------------
./windows/test/tellub/tellub.dsp
./windows/test/testhdf5/testhdf5.dsp
./windows/test/testhdf5dll/testhdf5dll.dsp
+./windows/test/ttsafedll/ttsafedll.dsp
./windows/test/unlink/unlink.dsp
./windows/test/unlinkdll/unlinkdll.dsp
./windows/test/hdf5test.bat
diff --git a/test/ttsafe_acreate.c b/test/ttsafe_acreate.c
index f4f418b..1ab54a8 100644
--- a/test/ttsafe_acreate.c
+++ b/test/ttsafe_acreate.c
@@ -87,12 +87,12 @@ void tts_acreate(void)
* creation plist and default file access plist
*/
file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- assert(file>=0);
+ assert(file>=0);
/* create a simple dataspace for the dataset */
dimsf[0] = 1;
dataspace = H5Screate_simple(1, dimsf, NULL);
- assert(dataspace>=0);
+ assert(dataspace>=0);
/* define datatype for the data using native little endian integers */
datatype = H5Tcopy(H5T_NATIVE_INT);
@@ -100,13 +100,12 @@ void tts_acreate(void)
/* create a new dataset within the file */
dataset = H5Dcreate(file, DATASETNAME, datatype, dataspace, H5P_DEFAULT);
- assert(dataset>=0);
+ assert(dataset>=0);
/* initialize data for dataset and write value to dataset */
data = NUM_THREADS;
- ret=H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
- H5P_DEFAULT, &data);
- assert(ret>=0);
+ ret=H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &data);
+ assert(ret>=0);
/*
* Simultaneously create a large number of attributes to be associated
@@ -119,13 +118,13 @@ void tts_acreate(void)
attrib_data->dataspace = dataspace;
attrib_data->current_index = i;
ret=pthread_create(&threads[i], NULL, tts_acreate_thread, attrib_data);
- assert(ret==0);
+ assert(ret==0);
}
for (i = 0; i < NUM_THREADS; i++) {
ret=pthread_join(threads[i], NULL);
- assert(ret==0);
- }
+ assert(ret==0);
+ }
/* verify the correctness of the test */
diff --git a/test/ttsafe_cancel.c b/test/ttsafe_cancel.c
index 71b0529..b707240 100644
--- a/test/ttsafe_cancel.c
+++ b/test/ttsafe_cancel.c
@@ -66,57 +66,56 @@ pthread_t childthread;
pthread_mutex_t mutex;
pthread_cond_t cond;
-//Global variables
-int ret;
-
void tts_cancel(void)
{
pthread_attr_t attribute;
hid_t dataset;
int buffer;
+ int ret;
/* make thread scheduling global */
ret=pthread_attr_init(&attribute);
- assert(ret==0);
+ assert(ret==0);
#ifdef H5_HAVE_SYSTEM_SCOPE_THREADS
ret=pthread_attr_setscope(&attribute, PTHREAD_SCOPE_SYSTEM);
- assert(ret==0);
+ assert(ret==0);
#endif /* H5_HAVE_SYSTEM_SCOPE_THREADS */
- ret=pthread_mutex_init(&mutex,NULL);
- assert(ret==0);
- ret=pthread_cond_init(&cond,NULL);
- assert(ret==0);
+ /* Initialize mutex & condition variables */
+ ret=pthread_mutex_init(&mutex,NULL);
+ assert(ret==0);
+ ret=pthread_cond_init(&cond,NULL);
+ assert(ret==0);
/*
* Create a hdf5 file using H5F_ACC_TRUNC access, default file
* creation plist and default file access plist
*/
cancel_file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- assert(cancel_file>=0);
+ assert(cancel_file>=0);
ret=pthread_create(&childthread, &attribute, tts_cancel_thread, NULL);
- assert(ret==0);
+ assert(ret==0);
tts_cancel_barrier();
ret=pthread_cancel(childthread);
- assert(ret==0);
+ assert(ret==0);
dataset = H5Dopen(cancel_file, DATASETNAME);
- assert(dataset>=0);
+ assert(dataset>=0);
ret=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &buffer);
- assert(ret>=0);
+ assert(ret>=0);
if (buffer != 11)
TestErrPrintf("operation unsuccessful with value at %d instead of 11\n", buffer);
ret=H5Dclose(dataset);
- assert(ret>=0);
+ assert(ret>=0);
ret=H5Fclose(cancel_file);
- assert(ret>=0);
+ assert(ret>=0);
/* Destroy the thread attribute */
ret=pthread_attr_destroy(&attribute);
- assert(ret==0);
+ assert(ret==0);
}
void *tts_cancel_thread(void UNUSED *arg)
@@ -126,17 +125,18 @@ void *tts_cancel_thread(void UNUSED *arg)
hid_t dataspace, datatype, dataset;
hsize_t dimsf[1]; /* dataset dimensions */
cancel_cleanup_t *cleanup_structure;
+ int ret;
/* define dataspace for dataset */
dimsf[0] = 1;
dataspace = H5Screate_simple(1,dimsf,NULL);
- assert(dataspace>=0);
+ assert(dataspace>=0);
/* define datatype for the data using native little endian integers */
datatype = H5Tcopy(H5T_NATIVE_INT);
- assert(datatype>=0);
+ assert(datatype>=0);
ret=H5Tset_order(datatype, H5T_ORDER_LE);
- assert(ret>=0);
+ assert(ret>=0);
/* create a new dataset within the file */
dataset = H5Dcreate(cancel_file, DATASETNAME, datatype, dataspace, H5P_DEFAULT);
@@ -156,7 +156,7 @@ void *tts_cancel_thread(void UNUSED *arg)
buffer = malloc(sizeof(int));
ret=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buffer);
- assert(ret>=0);
+ assert(ret>=0);
ret=H5Diterate(buffer, H5T_NATIVE_INT, dataspace, tts_cancel_callback, &dataset);
assert(ret>=0);
@@ -164,13 +164,13 @@ void *tts_cancel_thread(void UNUSED *arg)
datavalue = 100;
ret=H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &datavalue);
- assert(ret>=0);
+ assert(ret>=0);
ret=H5Dclose(dataset);
- assert(ret>=0);
+ assert(ret>=0);
ret=H5Tclose(datatype);
- assert(ret>=0);
+ assert(ret>=0);
ret=H5Sclose(dataspace);
- assert(ret>=0);
+ assert(ret>=0);
/*
* Required by pthreads. The argument 0 pops the stack but does not
@@ -186,6 +186,7 @@ herr_t tts_cancel_callback(void *elem, hid_t UNUSED type_id, unsigned UNUSED ndi
{
int value = *(int *)elem;
hid_t dataset = *(hid_t *)operator_data;
+ int ret;
tts_cancel_barrier();
sleep(3);
@@ -197,7 +198,7 @@ herr_t tts_cancel_callback(void *elem, hid_t UNUSED type_id, unsigned UNUSED ndi
value += 10;
ret=H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &value);
- assert(ret>=0);
+ assert(ret>=0);
return 0;
}
@@ -208,12 +209,14 @@ herr_t tts_cancel_callback(void *elem, hid_t UNUSED type_id, unsigned UNUSED ndi
void cancellation_cleanup(void *arg)
{
cancel_cleanup_t *cleanup_structure = (cancel_cleanup_t *)arg;
+ int ret;
+
ret=H5Dclose(cleanup_structure->dataset);
- assert(ret>=0);
+ assert(ret>=0);
ret=H5Tclose(cleanup_structure->datatype);
- assert(ret>=0);
+ assert(ret>=0);
ret=H5Sclose(cleanup_structure->dataspace);
- assert(ret>=0);
+ assert(ret>=0);
/* retained for debugging */
/* print_func("cancellation noted, cleaning up ... \n"); */
@@ -226,26 +229,27 @@ void cancellation_cleanup(void *arg)
void tts_cancel_barrier(void)
{
static int count = 2;
+ int ret;
ret=pthread_mutex_lock(&mutex);
- assert(ret==0);
+ assert(ret==0);
if (count != 1) {
count--;
ret=pthread_cond_wait(&cond, &mutex);
- assert(ret==0);
+ assert(ret==0);
} else {
- pthread_cond_signal(&cond);
- assert(ret==0);
+ ret=pthread_cond_signal(&cond);
+ assert(ret==0);
}
- pthread_mutex_unlock(&mutex);
- assert(ret==0);
+ ret=pthread_mutex_unlock(&mutex);
+ assert(ret==0);
}
void cleanup_cancel(void)
{
- HDunlink(FILENAME);
+ HDunlink(FILENAME);
}
#endif /*H5_HAVE_THREADSAFE*/
diff --git a/test/ttsafe_error.c b/test/ttsafe_error.c
index c8fdbab..a612751 100644
--- a/test/ttsafe_error.c
+++ b/test/ttsafe_error.c
@@ -60,7 +60,6 @@ static void *tts_error_thread(void *);
/* Global variables */
hid_t error_file;
-int ret;
typedef struct err_num_struct {
hid_t maj_num;
@@ -79,6 +78,7 @@ void tts_error(void)
pthread_attr_t attribute;
hid_t dataset;
int value, i;
+ int ret;
/* Must initialize these at runtime */
expected[0].maj_num = H5E_DATASET;
@@ -107,15 +107,15 @@ void tts_error(void)
/* set up mutex for global count of errors */
ret=pthread_mutex_init(&error_mutex, NULL);
- assert(ret==0);
+ assert(ret==0);
/* make thread scheduling global */
ret=pthread_attr_init(&attribute);
- assert(ret==0);
+ assert(ret==0);
#ifdef H5_HAVE_SYSTEM_SCOPE_THREADS
ret=pthread_attr_setscope(&attribute, PTHREAD_SCOPE_SYSTEM);
- assert(ret==0);
+ assert(ret==0);
#endif /* H5_HAVE_SYSTEM_SCOPE_THREADS */
/*
@@ -123,17 +123,17 @@ void tts_error(void)
* creation plist and default file access plist
*/
error_file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- assert(error_file>=0);
+ assert(error_file>=0);
for (i = 0; i < NUM_THREAD; i++){
ret=pthread_create(&threads[i], &attribute, tts_error_thread, NULL);
- assert(ret==0);
- }
+ assert(ret==0);
+ }
for (i = 0; i < NUM_THREAD; i++){
ret=pthread_join(threads[i],NULL);
- assert(ret==0);
- }
+ assert(ret==0);
+ }
if (error_flag)
TestErrPrintf("Threads reporting different error values!\n");
@@ -142,22 +142,22 @@ void tts_error(void)
TestErrPrintf("Error: %d threads failed instead of %d\n", error_count, NUM_THREAD-1);
dataset = H5Dopen(error_file, DATASETNAME);
- assert(dataset>=0);
+ assert(dataset>=0);
ret=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &value);
- assert(ret>=0);
+ assert(ret>=0);
if (value != WRITE_NUMBER)
TestErrPrintf("Error: Successful thread wrote value %d instead of %d\n", value, WRITE_NUMBER);
ret=H5Dclose(dataset);
- assert(ret>=0);
+ assert(ret>=0);
ret=H5Fclose(error_file);
- assert(ret>=0);
+ assert(ret>=0);
/* Destroy the thread attribute */
ret=pthread_attr_destroy(&attribute);
- assert(ret==0);
+ assert(ret==0);
}
static
@@ -168,6 +168,7 @@ void *tts_error_thread(void UNUSED *arg)
H5E_auto_stack_t old_error_cb;
void *old_error_client_data;
int value;
+ int ret;
/* preserve previous error stack handler */
H5Eget_auto_stack(H5E_DEFAULT, &old_error_cb, &old_error_client_data);
@@ -182,12 +183,11 @@ void *tts_error_thread(void UNUSED *arg)
/* define datatype for the data using native little endian integers */
datatype = H5Tcopy(H5T_NATIVE_INT);
- assert(datatype>=0);
+ assert(datatype>=0);
H5Tset_order(datatype, H5T_ORDER_LE);
/* create a new dataset within the file */
dataset = H5Dcreate(error_file, DATASETNAME, datatype, dataspace, H5P_DEFAULT);
-
if (dataset >= 0) { /* not an error */
value = WRITE_NUMBER;
H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &value);
@@ -195,9 +195,9 @@ void *tts_error_thread(void UNUSED *arg)
}
ret=H5Tclose(datatype);
- assert(ret>=0);
+ assert(ret>=0);
ret=H5Sclose(dataspace);
- assert(ret>=0);
+ assert(ret>=0);
/* turn our error stack handler off */
H5Eset_auto_stack(H5E_DEFAULT, old_error_cb, old_error_client_data);
@@ -208,11 +208,13 @@ void *tts_error_thread(void UNUSED *arg)
static
herr_t error_callback(void *client_data)
{
+ int ret;
+
ret=pthread_mutex_lock(&error_mutex);
- assert(ret==0);
+ assert(ret==0);
error_count++;
ret=pthread_mutex_unlock(&error_mutex);
- assert(ret==0);
+ assert(ret==0);
return H5Ewalk(H5E_WALK_DOWNWARD, walk_error_callback, client_data);
}