Recurse with may_block = FALSE, so we don't get into the pathology where
authorOwen Taylor <otaylor@redhat.com>
Fri, 2 Nov 2001 02:56:08 +0000 (02:56 +0000)
committerOwen Taylor <otaylor@src.gnome.org>
Fri, 2 Nov 2001 02:56:08 +0000 (02:56 +0000)
Thu Nov  1 21:48:43 2001  Owen Taylor  <otaylor@redhat.com>

        * tests/mainloop-test.c (recurser_idle): Recurse
        with may_block = FALSE, so we don't get into
        the pathology where the recurser_idle recurses
        for 10 iterations, and the only thing that is
        running is the recurser idle, which adds
        another recursion for each of those 10 iterations
        and....

        * tests/mainloop-test.c (create_crawler): Fix race
        condition where a crawler source could be destroyed
        before it was added to the crawler array.

        * test/Makefile.am: Add mainloop-test back.

ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-12
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
tests/Makefile.am
tests/mainloop-test.c

index 73d791b..e94ee09 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+Thu Nov  1 21:48:43 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * tests/mainloop-test.c (recurser_idle): Recurse
+       with may_block = FALSE, so we don't get into
+       the pathology where the recurser_idle recurses
+       for 10 iterations, and the only thing that is
+       running is the recurser idle, which adds
+       another recursion for each of those 10 iterations
+       and....
+
+       * tests/mainloop-test.c (create_crawler): Fix race
+       condition where a crawler source could be destroyed
+       before it was added to the crawler array.
+
+       * test/Makefile.am: Add mainloop-test back.
+       
 2001-11-01  Marius Andreiana  <mandreiana@yahoo.com>
 
        * configure.in: Added ro (Romanian) to ALL_LINGUAS
index 73d791b..e94ee09 100644 (file)
@@ -1,3 +1,19 @@
+Thu Nov  1 21:48:43 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * tests/mainloop-test.c (recurser_idle): Recurse
+       with may_block = FALSE, so we don't get into
+       the pathology where the recurser_idle recurses
+       for 10 iterations, and the only thing that is
+       running is the recurser idle, which adds
+       another recursion for each of those 10 iterations
+       and....
+
+       * tests/mainloop-test.c (create_crawler): Fix race
+       condition where a crawler source could be destroyed
+       before it was added to the crawler array.
+
+       * test/Makefile.am: Add mainloop-test back.
+       
 2001-11-01  Marius Andreiana  <mandreiana@yahoo.com>
 
        * configure.in: Added ro (Romanian) to ALL_LINGUAS
index 73d791b..e94ee09 100644 (file)
@@ -1,3 +1,19 @@
+Thu Nov  1 21:48:43 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * tests/mainloop-test.c (recurser_idle): Recurse
+       with may_block = FALSE, so we don't get into
+       the pathology where the recurser_idle recurses
+       for 10 iterations, and the only thing that is
+       running is the recurser idle, which adds
+       another recursion for each of those 10 iterations
+       and....
+
+       * tests/mainloop-test.c (create_crawler): Fix race
+       condition where a crawler source could be destroyed
+       before it was added to the crawler array.
+
+       * test/Makefile.am: Add mainloop-test back.
+       
 2001-11-01  Marius Andreiana  <mandreiana@yahoo.com>
 
        * configure.in: Added ro (Romanian) to ALL_LINGUAS
index 73d791b..e94ee09 100644 (file)
@@ -1,3 +1,19 @@
+Thu Nov  1 21:48:43 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * tests/mainloop-test.c (recurser_idle): Recurse
+       with may_block = FALSE, so we don't get into
+       the pathology where the recurser_idle recurses
+       for 10 iterations, and the only thing that is
+       running is the recurser idle, which adds
+       another recursion for each of those 10 iterations
+       and....
+
+       * tests/mainloop-test.c (create_crawler): Fix race
+       condition where a crawler source could be destroyed
+       before it was added to the crawler array.
+
+       * test/Makefile.am: Add mainloop-test back.
+       
 2001-11-01  Marius Andreiana  <mandreiana@yahoo.com>
 
        * configure.in: Added ro (Romanian) to ALL_LINGUAS
index 73d791b..e94ee09 100644 (file)
@@ -1,3 +1,19 @@
+Thu Nov  1 21:48:43 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * tests/mainloop-test.c (recurser_idle): Recurse
+       with may_block = FALSE, so we don't get into
+       the pathology where the recurser_idle recurses
+       for 10 iterations, and the only thing that is
+       running is the recurser idle, which adds
+       another recursion for each of those 10 iterations
+       and....
+
+       * tests/mainloop-test.c (create_crawler): Fix race
+       condition where a crawler source could be destroyed
+       before it was added to the crawler array.
+
+       * test/Makefile.am: Add mainloop-test back.
+       
 2001-11-01  Marius Andreiana  <mandreiana@yahoo.com>
 
        * configure.in: Added ro (Romanian) to ALL_LINGUAS
index 73d791b..e94ee09 100644 (file)
@@ -1,3 +1,19 @@
+Thu Nov  1 21:48:43 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * tests/mainloop-test.c (recurser_idle): Recurse
+       with may_block = FALSE, so we don't get into
+       the pathology where the recurser_idle recurses
+       for 10 iterations, and the only thing that is
+       running is the recurser idle, which adds
+       another recursion for each of those 10 iterations
+       and....
+
+       * tests/mainloop-test.c (create_crawler): Fix race
+       condition where a crawler source could be destroyed
+       before it was added to the crawler array.
+
+       * test/Makefile.am: Add mainloop-test back.
+       
 2001-11-01  Marius Andreiana  <mandreiana@yahoo.com>
 
        * configure.in: Added ro (Romanian) to ALL_LINGUAS
index 73d791b..e94ee09 100644 (file)
@@ -1,3 +1,19 @@
+Thu Nov  1 21:48:43 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * tests/mainloop-test.c (recurser_idle): Recurse
+       with may_block = FALSE, so we don't get into
+       the pathology where the recurser_idle recurses
+       for 10 iterations, and the only thing that is
+       running is the recurser idle, which adds
+       another recursion for each of those 10 iterations
+       and....
+
+       * tests/mainloop-test.c (create_crawler): Fix race
+       condition where a crawler source could be destroyed
+       before it was added to the crawler array.
+
+       * test/Makefile.am: Add mainloop-test back.
+       
 2001-11-01  Marius Andreiana  <mandreiana@yahoo.com>
 
        * configure.in: Added ro (Romanian) to ALL_LINGUAS
index 73d791b..e94ee09 100644 (file)
@@ -1,3 +1,19 @@
+Thu Nov  1 21:48:43 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * tests/mainloop-test.c (recurser_idle): Recurse
+       with may_block = FALSE, so we don't get into
+       the pathology where the recurser_idle recurses
+       for 10 iterations, and the only thing that is
+       running is the recurser idle, which adds
+       another recursion for each of those 10 iterations
+       and....
+
+       * tests/mainloop-test.c (create_crawler): Fix race
+       condition where a crawler source could be destroyed
+       before it was added to the crawler array.
+
+       * test/Makefile.am: Add mainloop-test back.
+       
 2001-11-01  Marius Andreiana  <mandreiana@yahoo.com>
 
        * configure.in: Added ro (Romanian) to ALL_LINGUAS
index 60813e1..022b05b 100644 (file)
@@ -62,6 +62,7 @@ test_programs =                                       \
        hash-test                               \
        iochannel-test                          \
        list-test                               \
+       mainloop-test                           \
        module-test                             \
        node-test                               \
        queue-test                              \
@@ -102,7 +103,7 @@ gio_test_LDADD = $(progs_LDADD)
 hash_test_LDADD = $(progs_LDADD)
 iochannel_test_LDADD = $(progs_LDADD)
 list_test_LDADD = $(progs_LDADD)
-#mainloop_test_LDADD = $(thread_LDADD)
+mainloop_test_LDADD = $(thread_LDADD)
 markup_test_LDADD = $(progs_LDADD)
 module_test_LDADD = $(module_LDADD)
 module_test_LDFLAGS = @G_MODULE_LDFLAGS@
index 7fb0004..52cd684 100644 (file)
 #define CRAWLER_TIMEOUT_RANGE 40
 #define RECURSER_TIMEOUT 50
 
+/* The partial ordering between the context array mutex and
+ * crawler array mutex is that the crawler array mutex cannot
+ * be locked while the context array mutex is locked
+ */
 GPtrArray *context_array;
 GMutex *context_array_mutex;
 GCond *context_array_cond;
@@ -327,13 +331,14 @@ create_crawler (void)
   GSource *source = g_timeout_source_new (g_random_int_range (0, CRAWLER_TIMEOUT_RANGE));
   g_source_set_callback (source, (GSourceFunc)crawler_callback, source, NULL);
 
+  G_LOCK (crawler_array_lock);
+  g_ptr_array_add (crawler_array, source);
+  
   g_mutex_lock (context_array_mutex);
   g_source_attach (source, context_array->pdata[g_random_int_range (0, context_array->len)]);
   g_source_unref (source);
   g_mutex_unlock (context_array_mutex);
 
-  G_LOCK (crawler_array_lock);
-  g_ptr_array_add (crawler_array, source);
   G_UNLOCK (crawler_array_lock);
 }
 
@@ -361,7 +366,7 @@ recurser_idle (gpointer data)
   gint i;
 
   for (i = 0; i < 10; i++)
-    g_main_context_iteration (context, TRUE);
+    g_main_context_iteration (context, FALSE);
 
   return FALSE;
 }