Re: deprecating gdk threads



On Mon, 2012-08-06 at 17:08 +0200, Pavel Holejsovsky wrote:

> Basically, we define well-known ID for storing MainContext into any 
> gobject's data slot (g_object_set_data).  It is up to implementation 
> (i.e. GTK/GDK/Clutter) to store an appropriate GMainContext instance to 
> this slot, marking the object as belonging to this context.

This raises the question "what main context"?  I'd suggest that GTK
should store the result of g_main_context_get_thread_default() when
gtk_init() is called.

Also, how does the object slot get set?   Add it to _constructed for
each object in GTK+?  And then we need to patch the bindings to check
for it?

I'm thinking a cleaner solution is to just patch gtk+ like this:

1) Capture the context at gtk_init() time
2) Patch each finalize method that calls thread-unsafe functions (e.g.
   libX11) to use g_main_context_invoke (gtk_get_main_context (),
                                         gdk_x11_cursor_real_finalize, object)

The thing to note here is that we don't need to bounce every
g_object_unref(), we just need to ensure the finalizers are run in the
default main context.




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