summaryrefslogtreecommitdiffstats
path: root/test/vfd_swmr_common.c
diff options
context:
space:
mode:
authorsongyulu <songyulu@jelly.ad.hdfgroup.org>2021-03-05 15:44:36 (GMT)
committersongyulu <songyulu@jelly.ad.hdfgroup.org>2021-03-05 15:44:36 (GMT)
commit8e14c386aaa9e09dd9bc7d2b28995ff73b1a9903 (patch)
tree501665e5e7f3d62cd3b49e807c32c4fa54e13c58 /test/vfd_swmr_common.c
parent511b940da6fa60e163f6f94e423f6cbd2879468d (diff)
downloadhdf5-8e14c386aaa9e09dd9bc7d2b28995ff73b1a9903.zip
hdf5-8e14c386aaa9e09dd9bc7d2b28995ff73b1a9903.tar.gz
hdf5-8e14c386aaa9e09dd9bc7d2b28995ff73b1a9903.tar.bz2
Changed the signal handling to named pipes for communication between the writer and reader, mainly in the zoo test as a starting point.
Diffstat (limited to 'test/vfd_swmr_common.c')
-rw-r--r--test/vfd_swmr_common.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/vfd_swmr_common.c b/test/vfd_swmr_common.c
index 043b7ed..bc68617 100644
--- a/test/vfd_swmr_common.c
+++ b/test/vfd_swmr_common.c
@@ -63,6 +63,21 @@ below_speed_limit(struct timespec *last, const struct timespec *ival)
return result;
}
+/* Sleep for `tenths` tenths of a second.
+ *
+ * This routine may quietly perform a too-short sleep if an error occurs
+ * in nanosleep(2).
+ */
+void
+decisleep(uint32_t tenths)
+{
+ struct timespec delay = {.tv_sec = tenths / 10,
+ .tv_nsec = tenths * 100 * 1000 * 1000};
+
+ while (nanosleep(&delay, &delay) == -1 && errno == EINTR)
+ ; // do nothing
+}
+
/* Like vsnprintf(3), but abort the program with an error message on
* `stderr` if the buffer is too small or some other error occurs.
*/