summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomasz Miąsko <tomasz.miasko@gmail.com>2018-11-04 00:00:00 +0000
committerTomasz Miąsko <tomasz.miasko@gmail.com>2018-11-04 17:28:43 +0100
commit83221671ea0064b5e5326f57d8075f8653da15c6 (patch)
tree2bc1266bf41bddb145762a372d47ff44581ca769
parentb09a0df9a9494509421cc5130eb07ca12145e44a (diff)
downloadglib-83221671ea0064b5e5326f57d8075f8653da15c6.tar.gz
tests: Fix data races in refcount/closures.c
-rw-r--r--tests/refcount/closures.c10
1 files changed, 1 insertions, 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 */