[glib: 1/4] tests: Fix data races in refcount/closures.c
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 1/4] tests: Fix data races in refcount/closures.c
- Date: Tue, 13 Nov 2018 13:13:03 +0000 (UTC)
commit 83221671ea0064b5e5326f57d8075f8653da15c6
Author: Tomasz Miąsko <tomasz miasko gmail com>
Date: Sun Nov 4 00:00:00 2018 +0000
tests: Fix data races in refcount/closures.c
tests/refcount/closures.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
---
diff --git a/tests/refcount/closures.c b/tests/refcount/closures.c
index 25b0a2779..07320ec2c 100644
--- a/tests/refcount/closures.c
+++ b/tests/refcount/closures.c
@@ -153,19 +153,11 @@ my_test_class_init (GTestClass *klass)
klass->test_signal2 = my_test_test_signal2;
}
-static inline guint32
-quick_rand32 (void)
-{
- static guint32 accu = 2147483563;
- accu = 1664525 * accu + 1013904223;
- return accu;
-}
-
static void
test_closure (GClosure *closure)
{
/* try to produce high contention in closure->ref_count */
- guint i = 0, n = quick_rand32() % 199;
+ guint i = 0, n = g_random_int () % 199;
for (i = 0; i < n; i++)
g_closure_ref (closure);
g_closure_sink (closure); /* NOP */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]