From 57e5c4305cb0b741fb28fc7286ae9dd11d4acf56 Mon Sep 17 00:00:00 2001 From: David Young Date: Thu, 30 Apr 2020 15:22:36 -0500 Subject: Avoid deadlock of reader and writer: make the writer flush file content before waiting for the reader's message. --- test/vfd_swmr_common.c | 6 ++++++ 1 file changed, 6 insertions(+) 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); -- cgit v0.12