Re: Print dialog hangs for several seconds before activating



On Wed, 2010-06-09 at 20:20 -0400, David A Benjamin wrote:
> I've run into this issue (and have been poking at it recently). The core 
> problem appears to be that, although GTK+ is using CUPS and setting things 
> like httpBlocking off, the CUPS "non-blocking" API isn't. See 
> conversations with CUPS developers at [1,2,3].

Yeah, it seems like threads are the way to go.

> It appears that the only sane way to interact with CUPS in a GUI 
> application is to use separate threads. If folks do not object the change, 
> I'll try my hand at them.

Historically gtk+ could not depend on threads being enabled, leaving it
up to apps to call g_thread_init() and gdk_thread_init(). However, as of
glib 2.24 gobject now calls g_thread_init(), so it should be safe to use
threads in gtk+. You can't call gtk+ widget code from a thread though,
as apps may still not have called gdk_thread_init(), so you need to
marshal any thread results back to the mainloop (via e.g. g_idle_add()).

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
       alexl redhat com            alexander larsson gmail com 
He's an unconventional coffee-fuelled vagrant on the run. She's a 
transdimensional snooty mercenary who can talk to animals. They fight crime! 



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