Re: Performance ideas (resend) ...



Michael Meeks wrote:
> 	Did you consider doing:
> 
> 	if (g_main_context_is_owner (NULL)) {
> 		/* we are the main thread or equivalent */
> 		do_gconf_foo_init (NULL);
> 	} else {
> 		Waiter foo;
> 		g_idle_add (do_gconf_foo_init, &foo);
> 		g_pseudo_foo_wait (&foo);
> 	}
> 
> 	As/when the thumbnailing API itself is called ? at least, this is what
> I intended g_main_context_is_owner to be good for (though perhaps it is
> still not quite what we want) ;-)

Seems like to prevent races (and the "called before main loop started"
case you mentioned) it would be better to do

    if (g_main_context_acquire (NULL)) {
        do_gconf_foo_init (NULL);
        g_main_context_release (NULL);
    } else {
        ...

-- Dan


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