summaryrefslogtreecommitdiffstats
path: root/test/vfd_swmr_common.c
diff options
context:
space:
mode:
authorDavid Young <dyoung@hdfgroup.org>2020-04-30 20:22:36 (GMT)
committerDavid Young <dyoung@hdfgroup.org>2020-04-30 20:22:36 (GMT)
commit57e5c4305cb0b741fb28fc7286ae9dd11d4acf56 (patch)
tree91acc22c3f942804828f4ee17e280d51c1f7cc23 /test/vfd_swmr_common.c
parentbecb9d82928e8bf1e783e310542d5cbfd38fba94 (diff)
downloadhdf5-57e5c4305cb0b741fb28fc7286ae9dd11d4acf56.zip
hdf5-57e5c4305cb0b741fb28fc7286ae9dd11d4acf56.tar.gz
hdf5-57e5c4305cb0b741fb28fc7286ae9dd11d4acf56.tar.bz2
Avoid deadlock of reader and writer: make the writer flush file content
before waiting for the reader's message.
Diffstat (limited to 'test/vfd_swmr_common.c')
-rw-r--r--test/vfd_swmr_common.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/vfd_swmr_common.c b/test/vfd_swmr_common.c
index bf1cc59..7db2bba 100644
--- a/test/vfd_swmr_common.c
+++ b/test/vfd_swmr_common.c
@@ -122,6 +122,12 @@ await_signal(hid_t fid)
__func__, __LINE__);
}
+ /* Avoid deadlock: flush the file before waiting for the reader's
+ * message.
+ */
+ if (H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0)
+ errx(EXIT_FAILURE, "%s: H5Fflush failed", __func__);
+
for (;;) {
const int rc = sigtimedwait(&sleepset, NULL, &tick);