From 3b7aacb5673a2b0ad070d9d1f109f9a142d0cad8 Mon Sep 17 00:00:00 2001 From: Alexey Kopytov Date: Mon, 17 Dec 2018 21:55:10 +0300 Subject: [PATCH] --rate mode: fix a bogus error about eventgen thread termination When the --rate option was used together with the --time option, a bogus "Terminating the event generator thread failed" error was thrown at the end of the test. --- src/sysbench.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/sysbench.c b/src/sysbench.c index 07d5924..96121aa 100644 --- a/src/sysbench.c +++ b/src/sysbench.c @@ -1190,8 +1190,12 @@ static int run_test(sb_test_t *test) if (eventgen_thread_created) { - if (sb_thread_cancel(eventgen_thread) || - sb_thread_join(eventgen_thread, NULL)) + /* + When a time limit is used, the event generation thread may terminate + itself. + */ + if ((sb_thread_cancel(eventgen_thread) || + sb_thread_join(eventgen_thread, NULL)) && sb_globals.max_time_ns == 0) log_text(LOG_FATAL, "Terminating the event generator thread failed."); }