summaryrefslogtreecommitdiffstats
path: root/fortran/src/H5Lf.c
Commit message (Expand)AuthorAgeFilesLines
* Merge pull request #426 in HDFFV/hdf5 from ~LRKNOX/hdf5_lrk:hdf5_1_10 to hdf5...Larry Knox2017-04-251-6/+4
* [svn-r27493] Trying again to merge the F2003_v1.10 branch to the trunk.Scot Breitenfeld2015-08-111-162/+162
* [svn-r27489] reverted merge of branchScot Breitenfeld2015-08-111-162/+162
* [svn-r27377] Cleaned-up comment formatting:Scot Breitenfeld2015-07-141-147/+147
* [svn-r26809] Changed Fortran file endings from ".f90" to ".F90"Scot Breitenfeld2015-04-141-15/+15
* [svn-r26481] Removed compiler warnings. HDF5-239Scot Breitenfeld2015-03-191-6/+9
* [svn-r26010] Fix for:Scot Breitenfeld2015-01-221-7/+7
* [svn-r23293] Fix for HDFFV-8268: Fortran wrapper for H5Fget_file_image function.Scot Breitenfeld2013-02-181-1/+1
* [svn-r21248] Mereged the F2003 branch into the trunk.Scot Breitenfeld2011-08-181-162/+455
* [svn-r20061] Description:Quincey Koziol2011-02-081-5/+8
* [svn-r19654] Description:Quincey Koziol2010-10-211-1/+1
* [svn-r18157] Description:Quincey Koziol2010-01-231-128/+85
* [svn-r17482] Scot Breitenfeld2009-09-151-5/+7
* [svn-r15628] Description:Quincey Koziol2008-09-161-54/+54
* [svn-r14991] Maintenance: Fixed some bugs discovered by daily testing and by ...Elena Pourmal2008-05-131-2/+2
* [svn-r14930] Maintenance: Fixed more bugs/typos and enabled tests that were f...Elena Pourmal2008-05-051-1/+1
* [svn-r14923] Maintenance: This check-in merges changes from the fortran_1_8 b...Elena Pourmal2008-05-031-0/+817
* [svn-r14903] Undoing change committed in r14902.Scot Breitenfeld2008-04-301-817/+0
* [svn-r14902] Merged fortran_1_8 branch changes r14505:14901 into the trunk. N...Scot Breitenfeld2008-04-301-0/+817
an> * Incorporated into library tests. * * 19 May 2000, Bill Wendling * Changed so that it creates its own HDF5 file and removes it at cleanup * time. * ********************************************************************/ #include "ttsafe.h" #ifdef H5_HAVE_THREADSAFE #include <stdio.h> #include <stdlib.h> #define FILENAME "ttsafe_acreate.h5" #define DATASETNAME "IntData" #define NUM_THREADS 16 void *tts_acreate_thread(void *); typedef struct acreate_data_struct { hid_t dataset; hid_t datatype; hid_t dataspace; int current_index; } ttsafe_name_data_t; void tts_acreate(void) { /* Thread declarations */ H5TS_thread_t threads[NUM_THREADS]; /* HDF5 data declarations */ hid_t file, dataset; hid_t dataspace, datatype; hid_t attribute; hsize_t dimsf[1]; /* dataset dimensions */ /* data declarations */ int data; /* data to write */ int buffer, ret, i; ttsafe_name_data_t *attrib_data; /* * Create an HDF5 file using H5F_ACC_TRUNC access, default file * creation plist and default file access plist */ file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); assert(file>=0); /* create a simple dataspace for the dataset */ dimsf[0] = 1; dataspace = H5Screate_simple(1, dimsf, NULL); assert(dataspace>=0); /* define datatype for the data using native little endian integers */ datatype = H5Tcopy(H5T_NATIVE_INT); H5Tset_order(datatype, H5T_ORDER_LE); /* create a new dataset within the file */ dataset = H5Dcreate2(file, DATASETNAME, datatype, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); 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); /* * Simultaneously create a large number of attributes to be associated * with the dataset */ for(i = 0; i < NUM_THREADS; i++) { attrib_data = HDmalloc(sizeof(ttsafe_name_data_t)); attrib_data->dataset = dataset; attrib_data->datatype = datatype; attrib_data->dataspace = dataspace; attrib_data->current_index = i; threads[i] = H5TS_create_thread(tts_acreate_thread, NULL, attrib_data); } /* end for */ for(i = 0; i < NUM_THREADS; i++) { H5TS_wait_for_thread(threads[i]); } /* end for */ /* verify the correctness of the test */ for(i = 0; i < NUM_THREADS; i++) { attribute = H5Aopen(dataset, gen_name(i), H5P_DEFAULT); if(attribute < 0) TestErrPrintf("unable to open appropriate attribute. Test failed!\n"); else { ret = H5Aread(attribute, H5T_NATIVE_INT, &buffer); if(ret < 0 || buffer != i) TestErrPrintf("wrong data values. Test failed!\n"); H5Aclose(attribute); } /* end else */ } /* end for */ /* close remaining resources */ ret = H5Sclose(dataspace); assert(ret >= 0); ret = H5Tclose(datatype); assert(ret >= 0); ret = H5Dclose(dataset); assert(ret >= 0); ret = H5Fclose(file); assert(ret >= 0); } void *tts_acreate_thread(void *client_data) { hid_t attribute; char *attribute_name; int *attribute_data; /* data for attributes */ ttsafe_name_data_t *attrib_data; attrib_data = (ttsafe_name_data_t *)client_data; /* Create attribute */ attribute_name = gen_name(attrib_data->current_index); attribute = H5Acreate2(attrib_data->dataset, attribute_name, attrib_data->datatype, attrib_data->dataspace, H5P_DEFAULT, H5P_DEFAULT); /* Write data to the attribute */ attribute_data = HDmalloc(sizeof(int)); *attribute_data = attrib_data->current_index; H5Awrite(attribute, H5T_NATIVE_INT, attribute_data); H5Aclose(attribute); return NULL; } void cleanup_acreate(void) { HDunlink(FILENAME); } #endif /*H5_HAVE_THREADSAFE*/