From 316ab37d93f594692ec1abb3bb25b3ba1c0455a9 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Mon, 5 Sep 2011 07:15:30 -0400 Subject: [PATCH] Add no locking test option for glib hash Signed-off-by: Mathieu Desnoyers --- tests/test_glib_hash.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/test_glib_hash.c b/tests/test_glib_hash.c index 80579f7..5295c19 100644 --- a/tests/test_glib_hash.c +++ b/tests/test_glib_hash.c @@ -104,7 +104,7 @@ static unsigned long rduration; static unsigned long init_hash_size = DEFAULT_HASH_SIZE; static unsigned long init_populate; static unsigned long rand_pool = DEFAULT_RAND_POOL; -static int add_only, add_unique; +static int add_only, add_unique, no_mutex; static inline void loop_sleep(unsigned long l) { @@ -176,6 +176,8 @@ void rcu_copy_mutex_lock(void) { int ret; + if (no_mutex) + return; ret = pthread_mutex_lock(&rcu_copy_mutex); if (ret) { perror("Error in pthread mutex lock"); @@ -187,6 +189,8 @@ void rcu_copy_mutex_unlock(void) { int ret; + if (no_mutex) + return; ret = pthread_mutex_unlock(&rcu_copy_mutex); if (ret) { perror("Error in pthread mutex unlock"); @@ -547,6 +551,7 @@ void show_usage(int argc, char **argv) printf(" [-u] Uniquify add."); printf(" [-i] Add only (no removal)."); printf(" [-k nr_nodes] Number of nodes to insert initially."); + printf(" [-l] No mutex."); printf("\n"); } @@ -647,6 +652,9 @@ int main(int argc, char **argv) case 'k': init_populate = atol(argv[++i]); break; + case 'l': + no_mutex = 1; + break; } } -- 2.34.1