[glib: 1/2] tests: Fix closure-refcount to preserve old semantics



commit d687a45704a47b9e83ad1f47c1a2ea1ad5411463
Author: Krzesimir Nowak <qdlacz gmail com>
Date:   Thu Feb 28 07:05:27 2019 +0100

    tests: Fix closure-refcount to preserve old semantics
    
    The threads used to iterate at least 10000 times before setting the
    "seen thread" flag to true. After porting they inadvertently did that
    in the first iteration.

 gobject/tests/closure-refcount.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/gobject/tests/closure-refcount.c b/gobject/tests/closure-refcount.c
index c64c366e1..5a920054c 100644
--- a/gobject/tests/closure-refcount.c
+++ b/gobject/tests/closure-refcount.c
@@ -183,7 +183,7 @@ thread1_main (gpointer user_data)
   TestClosureRefcountData *data = user_data;
   guint i = 0;
 
-  for (i = 0; !g_atomic_int_get (&data->stopping); i++)
+  for (i = 1; !g_atomic_int_get (&data->stopping); i++)
     {
       test_closure (data->closure);
       if (i % 10000 == 0)
@@ -202,7 +202,7 @@ thread2_main (gpointer user_data)
   TestClosureRefcountData *data = user_data;
   guint i = 0;
 
-  for (i = 0; !g_atomic_int_get (&data->stopping); i++)
+  for (i = 1; !g_atomic_int_get (&data->stopping); i++)
     {
       test_closure (data->closure);
       if (i % 10000 == 0)
@@ -291,7 +291,7 @@ test_closure_refcount (void)
    * thread1 and thread2. Even though @n_iterations is high, we can’t guarantee
    * that the scheduler allocates time fairly (or at all!) to thread1 or
    * thread2. */
-  for (i = 0;
+  for (i = 1;
        i < n_iterations ||
        !g_atomic_int_get (&test_data.seen_thread1) ||
        !g_atomic_int_get (&test_data.seen_thread2);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]