From 3aeef671d0f07856785efb8e3e5c559107be3ee0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Thu, 20 Apr 2023 17:01:05 +0200 Subject: glib/tests/[rec-]mutex: Allow each thread to work In non-perf mode, we were making only one thread to win the race to increase the value, but since we're launching more threads anyways let's allow more of them to have a chance to do something, to make the test more valuable, even if it's still quick enough. --- glib/tests/mutex.c | 2 +- glib/tests/rec-mutex.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/glib/tests/mutex.c b/glib/tests/mutex.c index 7aeb4a561..2d0ef1ff3 100644 --- a/glib/tests/mutex.c +++ b/glib/tests/mutex.c @@ -195,7 +195,7 @@ test_mutex_perf (gconstpointer data) gint x = -1; guint i; - count_to = g_test_perf () ? 100000000 : 1; + count_to = g_test_perf () ? 100000000 : n_threads + 1; g_assert (n_threads <= G_N_ELEMENTS (threads)); diff --git a/glib/tests/rec-mutex.c b/glib/tests/rec-mutex.c index d7cd62431..ad38a69a8 100644 --- a/glib/tests/rec-mutex.c +++ b/glib/tests/rec-mutex.c @@ -204,7 +204,7 @@ test_mutex_perf (gconstpointer data) n_threads = c / 256; depth = c % 256; - count_to = g_test_perf () ? 100000000 : 1; + count_to = g_test_perf () ? 100000000 : n_threads + 1; for (i = 0; i < n_threads - 1; i++) threads[i] = g_thread_new ("test", addition_thread, &x); -- cgit v1.2.1