aboutsummaryrefslogtreecommitdiff
path: root/test/tsan/process_sleep.h
diff options
context:
space:
mode:
Diffstat (limited to 'test/tsan/process_sleep.h')
-rw-r--r--test/tsan/process_sleep.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/tsan/process_sleep.h b/test/tsan/process_sleep.h
new file mode 100644
index 000000000000..5938a42bf8b2
--- /dev/null
+++ b/test/tsan/process_sleep.h
@@ -0,0 +1,7 @@
+#include <time.h>
+
+static void process_sleep(int sec) {
+ clock_t beg = clock();
+ while((clock() - beg) / CLOCKS_PER_SEC < sec)
+ usleep(100);
+}