On Sun, Jul 20, 2014 at 04:00:07PM +0200, Holger Hans Peter Freyther wrote:
Hi, > > I've looked at this code for a bit and I wonder why we don't inhibit the > > process switching here? Or at least add a way to crash hard if a process > > change is scheduled so I can see which mutex is hit. > > I have hit the wesp nest here. So GtkImage of VisualGST is adding various > "Processor activeProcess yield" into for loops as otherwise we get issues > with the garbage collector: > > ...scripts/Test.st:181: Too many garbage collections, finalizers missed! > ...scripts/Test.st:181: This is a bug, please repor > > Couldn't we copy the content of gcArray to a new array? Or run the > finalizer at another point? ignoring nested event loops I am running glib with the below local modification. The intention is to find places where a callback has yielded (either voluntarily or due waiting on a semaphore) the CPU while being in a call-in process. The code will then loop inside the pause() and I can attach with gdb and execute code to inspect it. diff --git a/packages/glib/Makefile.am b/packages/glib/Makefile.am index 182c12a..eddfb72 100644 --- a/packages/glib/Makefile.am +++ b/packages/glib/Makefile.am @@ -1,7 +1,7 @@ CLEANFILES = $(BUILT_SOURCES) gst_module_ldflags = -rpath $(moduleexecdir) -release $(VERSION) -module \ - -no-undefined -export-symbols-regex gst_initModule + -no-undefined -export-symbols-regex "gst_initModule|gst_glib_set_inhibit_dispatch" ALL_LIBS = $(GLIB_LIBS) $(GTHREAD_LIBS) diff --git a/packages/glib/gst-glib.c b/packages/glib/gst-glib.c index fb86974..cad11db 100644 --- a/packages/glib/gst-glib.c +++ b/packages/glib/gst-glib.c @@ -140,6 +140,15 @@ static GSList *loop_list; static GPollFD *fds; static int allocated_nfds, nfds; static int maxprio; +static int inhibit_dispatch; + +int +gst_glib_set_inhibit_dispatch(int do_inhibit) +{ + int old_inhibit = inhibit_dispatch; + inhibit_dispatch = do_inhibit; + return old_inhibit; +} static void main_loop_dispatch (void) @@ -148,6 +157,12 @@ main_loop_dispatch (void) if (!g_main_context_acquire (context)) abort (); + /* Do we inhibit running dispatch? */ + if (inhibit_dispatch) { + printf("BAD.. dispatch during execution\n"); + while(1) pause(); + } + g_main_context_dispatch (context); g_main_context_release (context); } diff --git a/packages/glib/gst-gobject.c b/packages/glib/gst-gobject.c index 949d547..dab7703 100644 --- a/packages/glib/gst-gobject.c +++ b/packages/glib/gst-gobject.c @@ -401,7 +401,7 @@ invoke_smalltalk_closure (GClosure *closure, OOP *args = alloca (sizeof (OOP) * stc->n_params); OOP resultOOP; - int i; + int i, inhibit; /* Less parameters than the event has, discard the ones in excess. */ if (stc->n_params < n_param_values) @@ -437,7 +437,10 @@ invoke_smalltalk_closure (GClosure *closure, args[i++] = stc->widget; } + inhibit = gst_glib_set_inhibit_dispatch(1); resultOOP = gst_nvmsg_send (stc->receiver, stc->selector, args, i); + gst_glib_set_inhibit_dispatch(inhibit); + /* FIXME Need to init return_value's type? */ if (return_value) _______________________________________________ help-smalltalk mailing list help-smalltalk@gnu.org https://lists.gnu.org/mailman/listinfo/help-smalltalk