From: Owen Taylor Date: Fri, 2 Nov 2001 02:56:08 +0000 (+0000) Subject: Recurse with may_block = FALSE, so we don't get into the pathology where X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=3481763c97fba98203c4fbfd5fe013817f048d3f;p=dana%2Fcg-glib.git Recurse with may_block = FALSE, so we don't get into the pathology where Thu Nov 1 21:48:43 2001 Owen Taylor * 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. --- diff --git a/ChangeLog b/ChangeLog index 73d791b4..e94ee090 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +Thu Nov 1 21:48:43 2001 Owen Taylor + + * 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 * configure.in: Added ro (Romanian) to ALL_LINGUAS diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 73d791b4..e94ee090 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,19 @@ +Thu Nov 1 21:48:43 2001 Owen Taylor + + * 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 * configure.in: Added ro (Romanian) to ALL_LINGUAS diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 73d791b4..e94ee090 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,19 @@ +Thu Nov 1 21:48:43 2001 Owen Taylor + + * 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 * configure.in: Added ro (Romanian) to ALL_LINGUAS diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index 73d791b4..e94ee090 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,19 @@ +Thu Nov 1 21:48:43 2001 Owen Taylor + + * 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 * configure.in: Added ro (Romanian) to ALL_LINGUAS diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 73d791b4..e94ee090 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,19 @@ +Thu Nov 1 21:48:43 2001 Owen Taylor + + * 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 * configure.in: Added ro (Romanian) to ALL_LINGUAS diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 73d791b4..e94ee090 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,19 @@ +Thu Nov 1 21:48:43 2001 Owen Taylor + + * 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 * configure.in: Added ro (Romanian) to ALL_LINGUAS diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 73d791b4..e94ee090 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,19 @@ +Thu Nov 1 21:48:43 2001 Owen Taylor + + * 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 * configure.in: Added ro (Romanian) to ALL_LINGUAS diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 73d791b4..e94ee090 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,19 @@ +Thu Nov 1 21:48:43 2001 Owen Taylor + + * 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 * configure.in: Added ro (Romanian) to ALL_LINGUAS diff --git a/tests/Makefile.am b/tests/Makefile.am index 60813e13..022b05bf 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -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@ diff --git a/tests/mainloop-test.c b/tests/mainloop-test.c index 7fb00043..52cd6845 100644 --- a/tests/mainloop-test.c +++ b/tests/mainloop-test.c @@ -18,6 +18,10 @@ #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; }