From 1c9ddea0e2abd429c2e6555b1ae7d5c8b2a1ec0f Mon Sep 17 00:00:00 2001 From: Alexey Kopytov Date: Wed, 24 Feb 2016 21:34:19 +0800 Subject: [PATCH] Properly initialize thread-local RNG state. --- sysbench/sb_thread.c | 3 --- sysbench/sysbench.c | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sysbench/sb_thread.c b/sysbench/sb_thread.c index d089a08..2799aab 100644 --- a/sysbench/sb_thread.c +++ b/sysbench/sb_thread.c @@ -39,9 +39,6 @@ int sb_thread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine) (void *), void *arg) { - /* Initialize thread-local RNG state */ - sb_srnd(sb_rnd()); - return pthread_create(thread, attr, start_routine, arg); } diff --git a/sysbench/sysbench.c b/sysbench/sysbench.c index 6fa3adc..3b3c32a 100644 --- a/sysbench/sysbench.c +++ b/sysbench/sysbench.c @@ -468,6 +468,9 @@ static void *runner_thread(void *arg) test = ctxt->test; thread_id = ctxt->id; + /* Initialize thread-local RNG state */ + sb_srnd(thread_id); + log_text(LOG_DEBUG, "Runner thread started (%d)!", thread_id); if (test->ops.thread_init != NULL && test->ops.thread_init(thread_id) != 0) {