From 98f483d24f69785a7fb2e988f1053c34e84a4e61 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Wed, 26 Jun 2013 17:01:20 -0400 Subject: [PATCH 1/1] test_urcu_hash*: initialize TLS seeds Signed-off-by: Mathieu Desnoyers --- tests/test_urcu_hash_rw.c | 6 ++++++ tests/test_urcu_hash_unique.c | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/tests/test_urcu_hash_rw.c b/tests/test_urcu_hash_rw.c index 48dc1a8..8802b9c 100644 --- a/tests/test_urcu_hash_rw.c +++ b/tests/test_urcu_hash_rw.c @@ -68,6 +68,8 @@ void *test_hash_rw_thr_reader(void *_count) printf_verbose("thread_begin %s, tid %lu\n", "reader", urcu_get_thread_id()); + URCU_TLS(rand_lookup) = urcu_get_thread_id() ^ time(NULL); + set_affinity(); rcu_register_thread(); @@ -127,6 +129,8 @@ void *test_hash_rw_thr_writer(void *_count) printf_verbose("thread_begin %s, tid %lu\n", "writer", urcu_get_thread_id()); + URCU_TLS(rand_lookup) = urcu_get_thread_id() ^ time(NULL); + set_affinity(); rcu_register_thread(); @@ -234,6 +238,8 @@ int test_hash_rw_populate_hash(void) printf("Starting rw test\n"); + URCU_TLS(rand_lookup) = urcu_get_thread_id() ^ time(NULL); + if ((add_unique || add_replace) && init_populate * 10 > init_pool_size) { printf("WARNING: required to populate %lu nodes (-k), but random " "pool is quite small (%lu values) and we are in add_unique (-u) or add_replace (-s) mode. Try with a " diff --git a/tests/test_urcu_hash_unique.c b/tests/test_urcu_hash_unique.c index 40d9e80..adbbde0 100644 --- a/tests/test_urcu_hash_unique.c +++ b/tests/test_urcu_hash_unique.c @@ -66,6 +66,8 @@ void *test_hash_unique_thr_reader(void *_count) printf_verbose("thread_begin %s, tid %lu\n", "reader", urcu_get_thread_id()); + URCU_TLS(rand_lookup) = urcu_get_thread_id() ^ time(NULL); + set_affinity(); rcu_register_thread(); @@ -129,6 +131,8 @@ void *test_hash_unique_thr_writer(void *_count) printf_verbose("thread_begin %s, tid %lu\n", "writer", urcu_get_thread_id()); + URCU_TLS(rand_lookup) = urcu_get_thread_id() ^ time(NULL); + set_affinity(); rcu_register_thread(); @@ -242,6 +246,8 @@ int test_hash_unique_populate_hash(void) printf("Starting uniqueness test.\n"); + URCU_TLS(rand_lookup) = urcu_get_thread_id() ^ time(NULL); + if (!init_populate) return 0; -- 2.34.1