Re: struggling with the non-recursive gdk_threads_enter



On Tue, 2008-12-30 at 21:47 -0500, Yu Feng wrote:
Dear Devels:

I am having troubles because the GMutex used gdk_threads_enter/leave can
be non-recursive.

I have a piece of code (g_module_check_init) to either be called from an
event dispatched by GDK(if the module is loaded via GtkSettings) or be
called directly without entering the GDK critical section(if the module
is loaded via GTK_MODULE).

The code need to be protected so that its execution is not interrupted
by GDK activities in other threads. How can I do this without a
recursive gdk critical section?

IMHO that is a Gtk+ bug. When loading the modules from GTK_MODULE it
should take the Gdk lock in order to provide the same behaviour in both
cases. The way its currently set up means its impossible to get module
loadind gdk-thread-safe in all cases. 

Its not really possible to drop the lock in the other case, so the only
solution is to take the lock in this case. Its also in line with general
Gtk+ behaviour to automatically have the gdk lock held when calling out
to external code.





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