summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLarry Knox <lrknox@hdfgroup.org>2017-04-03 23:48:51 (GMT)
committerLarry Knox <lrknox@hdfgroup.org>2017-04-03 23:48:51 (GMT)
commitd6ea49f5cbcaa852cd0caf34278ec61108667bc3 (patch)
treef1991a33af86c907fd4537d38b6ae2c78b3d52c8
parent6387f7099d22c66dab415c57f9fd547eb86e4ad5 (diff)
parentd522632b9e1f1d88db2117e89f3caba0dc4cf38b (diff)
downloadhdf5-d6ea49f5cbcaa852cd0caf34278ec61108667bc3.zip
hdf5-d6ea49f5cbcaa852cd0caf34278ec61108667bc3.tar.gz
hdf5-d6ea49f5cbcaa852cd0caf34278ec61108667bc3.tar.bz2
Merge pull request #390 in HDFFV/hdf5 from develop to hdf5_1_10
* commit 'd522632b9e1f1d88db2117e89f3caba0dc4cf38b': Switch to using flag in signal handler, to trigger dropping out of main loop and shutdown cleanly, instead of calling leave() from the signal handler. Fix HDFFV-8089 Description: Some code within an "ifdef H5D_CHUNK_DEBUG" block was using outdated data structure but not caught because the case of H5D_CHUNK_DEBUG being defined was never tested. It was commented out. I defined H5D_CHUNK_DEBUG, tested, and commented out again. Platforms tested: Linux/32 2.6 (jam) Linux/64 (platypus) Darwin (osx1010test)
-rw-r--r--hl/tools/h5watch/h5watch.c9
-rw-r--r--src/H5Dchunk.c10
2 files changed, 10 insertions, 9 deletions
diff --git a/hl/tools/h5watch/h5watch.c b/hl/tools/h5watch/h5watch.c
index 97dca7a..f37b2b4 100644
--- a/hl/tools/h5watch/h5watch.c
+++ b/hl/tools/h5watch/h5watch.c
@@ -43,6 +43,7 @@ static int g_display_width = 80; /* output width in characters */
static hbool_t g_simple_output = FALSE; /* make output more machine-readable */
static unsigned g_retry = DEFAULT_RETRY; /* # of times to try opening the file if somehow file is unstable */
static hbool_t g_display_hex = FALSE; /* display data in hexadecimal format : LATER */
+static hbool_t g_user_interrupt = FALSE; /* Flag to indicate that user interrupted execution */
static herr_t doprint(hid_t did, hsize_t *start, hsize_t *block, int rank);
static herr_t slicendump(hid_t did, hsize_t *prev_dims, hsize_t *cur_dims,
@@ -337,7 +338,8 @@ monitor_dataset(hid_t fid, char *dsetname)
goto done;
}
- while(1) {
+ /* Loop until an error occurs or the user interrupts execution */
+ while(!g_user_interrupt) {
/* Refreshes the dataset */
if(H5Drefresh(did) < 0) {
@@ -798,9 +800,8 @@ parse_command_line(int argc, const char *argv[])
*/
static void catch_signal(int H5_ATTR_UNUSED signo)
{
- /* Exit from h5watch */
- leave(EXIT_SUCCESS);
-
+ /* Set the flag to get out of the main loop */
+ g_user_interrupt = TRUE;
} /* catch_signal() */
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index 7a646af..63e692f 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -6060,9 +6060,9 @@ H5D__chunk_stats(const H5D_t *dset, hbool_t headers)
#endif
if (headers) {
- if (rdcc->nhits>0 || rdcc->nmisses>0) {
- miss_rate = 100.0 * rdcc->nmisses /
- (rdcc->nhits + rdcc->nmisses);
+ if (rdcc->stats.nhits>0 || rdcc->stats.nmisses>0) {
+ miss_rate = 100.0 * rdcc->stats.nmisses /
+ (rdcc->stats.nhits + rdcc->stats.nmisses);
} else {
miss_rate = 0.0;
}
@@ -6073,8 +6073,8 @@ H5D__chunk_stats(const H5D_t *dset, hbool_t headers)
}
fprintf(H5DEBUG(AC), " %-18s %8u %8u %7s %8d+%-9ld\n",
- "raw data chunks", rdcc->nhits, rdcc->nmisses, ascii,
- rdcc->ninits, (long)(rdcc->nflushes)-(long)(rdcc->ninits));
+ "raw data chunks", rdcc->stats.nhits, rdcc->stats.nmisses, ascii,
+ rdcc->stats.ninits, (long)(rdcc->stats.nflushes)-(long)(rdcc->stats.ninits));
}
done: