diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2012-10-18 21:14:35 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2012-10-18 21:14:35 (GMT) |
commit | b624395cca176d28a89ad91b84fa19d5e7d36c55 (patch) | |
tree | 4c5d56fcf37206229b96848295e6e7f767dd8a8e /test/swmr_reader.c | |
parent | ddced9ab1d4f0fee92e6e4d1a244c6a85303b373 (diff) | |
download | hdf5-b624395cca176d28a89ad91b84fa19d5e7d36c55.zip hdf5-b624395cca176d28a89ad91b84fa19d5e7d36c55.tar.gz hdf5-b624395cca176d28a89ad91b84fa19d5e7d36c55.tar.bz2 |
[svn-r22922] Purpose:
Moved the file open/close back inside the loop in the SWMR reader
code. Without the open/close, the cache never refreshes so we
always see the initial amount.
Made a couple of other minor changes to the SWMR code.
Tested on:
jam
Diffstat (limited to 'test/swmr_reader.c')
-rw-r--r-- | test/swmr_reader.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/test/swmr_reader.c b/test/swmr_reader.c index 14e91ca..0ce368a 100644 --- a/test/swmr_reader.c +++ b/test/swmr_reader.c @@ -252,23 +252,23 @@ read_records(const char *filename, unsigned verbose, unsigned long nseconds, /* Emit informational message */ if(verbose) - printf("Reading records\n"); + fprintf(stderr, "Reading records\n"); /* Get the starting time */ start_time = time(NULL); curr_time = start_time; - - /* Emit informational message */ - if(verbose) - fprintf(stderr, "Opening file: %s\n", filename); - - /* Open the file */ - if((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, H5P_DEFAULT)) < 0) - return -1; /* Loop over reading records until [at least] the correct # of seconds have passed */ while(curr_time < (time_t)(start_time + (time_t)nseconds)) { + /* Emit informational message */ + if(verbose) + fprintf(stderr, "Opening file: %s\n", filename); + + /* Open the file */ + if((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, H5P_DEFAULT)) < 0) + return -1; + /* Check 'common' datasets, if any */ if(ncommon > 0) { /* Emit informational message */ @@ -299,6 +299,14 @@ read_records(const char *filename, unsigned verbose, unsigned long nseconds, } /* end for */ } /* end if */ + /* Emit informational message */ + if(verbose) + fprintf(stderr, "Closing file\n"); + + /* Close the file */ + if(H5Fclose(fid) < 0) + return -1; + /* Sleep for the appropriate # of seconds */ sleep(poll_time); @@ -306,14 +314,6 @@ read_records(const char *filename, unsigned verbose, unsigned long nseconds, curr_time = time(NULL); } /* end while */ - /* Emit informational message */ - if(verbose) - fprintf(stderr, "Closing file\n"); - - /* Close the file */ - if(H5Fclose(fid) < 0) - return -1; - /* Close the memory dataspace */ if(H5Sclose(mem_sid) < 0) return -1; |