From: Mathieu Desnoyers Date: Mon, 5 Sep 2011 11:15:30 +0000 (-0400) Subject: Add no locking test option for glib hash X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=316ab37d93f594692ec1abb3bb25b3ba1c0455a9;p=userspace-rcu.git Add no locking test option for glib hash Signed-off-by: Mathieu Desnoyers --- 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; } }