Re: Multi-threaded UI Freezes on GDK Call

2007-12-20 Thread Michael McCann
Emmanuele Bassi wrote: > On Tue, 2007-12-18 at 20:37 -0500, Michael McCann wrote: > > >> Yes, I've already tried that, to no avail. My code basically only >> consists of: >> >> gdk_screen_get_default(): Get the default screen >> gdk_screen_get_root_window(): Get the root window >> gdk_pixbuf_g

Re: Multi-threaded UI Freezes on GDK Call

2007-12-19 Thread Emmanuele Bassi
On Tue, 2007-12-18 at 20:37 -0500, Michael McCann wrote: > Yes, I've already tried that, to no avail. My code basically only > consists of: > > gdk_screen_get_default(): Get the default screen > gdk_screen_get_root_window(): Get the root window > gdk_pixbuf_get_from_drawable(): Get a pixbuf fr

Re: Multi-threaded UI Freezes on GDK Call

2007-12-19 Thread Dan H
On Tue, 18 Dec 2007 22:52:23 +0100 G Hasse <[EMAIL PROTECTED]> wrote: > The wrong thing is trying to do threads! > > Why Why Why are all people doing this thread programing! > I am convinced that with a propper design of your application, > maybe in several processe, you don't need threads and y

Re: Multi-threaded UI Freezes on GDK Call

2007-12-18 Thread Michael R. Head
On Tue, 2007-12-18 at 20:37 -0500, Michael McCann wrote: > Brian J. Tarricone wrote: > > Yes, I've already tried that, to no avail. My code basically only > consists of: > > gdk_screen_get_default(): Get the default screen > gdk_screen_get_root_window(): Get the root window > gdk_pixbuf_get_fr

Multi-threaded UI Freezes on GDK Call

2007-12-18 Thread Michael McCann
I've got a multithreaded GTK application. One thread runs gtk_main(): gtk_threads_enter(); gtk_main(); gtk_threads_leave(); The other thread is an infinite loop that sleeps for one second on each loop. Every x seconds, the infinite loop calls a function, which makes some GDK calls. At the begin

Re: Multi-threaded UI Freezes on GDK Call

2007-12-18 Thread Michael McCann
Brian J. Tarricone wrote: > Michael McCann wrote: > >> Brian J. Tarricone wrote: >> >>> Don't use gdk in the CPU-intensive function: >>> >> Unfortunately, the GDK calls _are_ what is CPU-intensive. I believe the >> gdk_pixbuf_get_from_drawable() call is the most intensive. None of m

Re: Multi-threaded UI Freezes on GDK Call

2007-12-18 Thread Brian J. Tarricone
Michael McCann wrote: > Brian J. Tarricone wrote: >> Don't use gdk in the CPU-intensive function: > Unfortunately, the GDK calls _are_ what is CPU-intensive. I believe the > gdk_pixbuf_get_from_drawable() call is the most intensive. None of my > "regular" code is CPU-intensive. How large is the

Re: Multi-threaded UI Freezes on GDK Call

2007-12-18 Thread Michael McCann
Michael R. Head wrote: > I'll break protocol and reply to my own message _again_... > > On Tue, 2007-12-18 at 19:05 -0500, Michael R. Head wrote: > >> On Tue, 2007-12-18 at 18:46 -0500, Michael McCann wrote: >> >>> Ahh, ok. How else can I accomplish my goal, then? I need to give GTK the >>

Re: Multi-threaded UI Freezes on GDK Call

2007-12-18 Thread Michael McCann
Brian J. Tarricone wrote: > Michael McCann wrote: > >> Michael R. Head wrote: >> >>> Does your special function take time to do its job? If so, then that >>> would be why. For example: >>> >>> ... >>> while(1) { >>> gdk_threads_enter(); >>> sleep(1) >>> gdk_threads_leave(); >>> sleep(10) >>

Re: Multi-threaded UI Freezes on GDK Call

2007-12-18 Thread G Hasse
On Tue, Dec 18, 2007 at 07:05:18PM -0500, Michael McCann wrote: > Tomas Carnecky wrote: > > Michael McCann wrote: > >> Michael R. Head wrote: > >>> On Tue, 2007-12-18 at 17:14 -0500, Michael R. Head wrote: > >>> > I assume you meant > > g_threads_init(); > gdk_threads_

Re: Multi-threaded UI Freezes on GDK Call

2007-12-18 Thread Brian J. Tarricone
Michael McCann wrote: > Michael R. Head wrote: >> Does your special function take time to do its job? If so, then that >> would be why. For example: >> >> ... >> while(1) { >> gdk_threads_enter(); >> sleep(1) >> gdk_threads_leave(); >> sleep(10) >> }; >> ... >> >> you'd freeze your app for a second

Re: Multi-threaded UI Freezes on GDK Call

2007-12-18 Thread Michael R. Head
I'll break protocol and reply to my own message _again_... On Tue, 2007-12-18 at 19:05 -0500, Michael R. Head wrote: > On Tue, 2007-12-18 at 18:46 -0500, Michael McCann wrote: > > > > Ahh, ok. How else can I accomplish my goal, then? I need to give GTK the > > lock, as I'm calling GDK from anoth

Re: Multi-threaded UI Freezes on GDK Call

2007-12-18 Thread Michael R. Head
On Tue, 2007-12-18 at 18:46 -0500, Michael McCann wrote: > > Ahh, ok. How else can I accomplish my goal, then? I need to give GTK the > lock, as I'm calling GDK from another function not in the main GTK loop. > I tried leaving out gdk_threads_enter()/leave() in the CPU-intensive > function, bu

Re: Multi-threaded UI Freezes on GDK Call

2007-12-18 Thread Michael McCann
Tomas Carnecky wrote: > Michael McCann wrote: >> Michael R. Head wrote: >>> On Tue, 2007-12-18 at 17:14 -0500, Michael R. Head wrote: >>> I assume you meant g_threads_init(); gdk_threads_init(); gtk_init(); gdk_threads_enter(); gtk_main()

Re: Multi-threaded UI Freezes on GDK Call

2007-12-18 Thread Tomas Carnecky
Michael McCann wrote: > Michael R. Head wrote: >> On Tue, 2007-12-18 at 17:14 -0500, Michael R. Head wrote: >> >>> I assume you meant >>> >>> g_threads_init(); >>> gdk_threads_init(); >>> gtk_init(); >>> >>> gdk_threads_enter(); >>> gtk_main(); >>> gdk_threads_leave(

Re: Multi-threaded UI Freezes on GDK Call

2007-12-18 Thread Michael McCann
Michael R. Head wrote: > On Tue, 2007-12-18 at 17:14 -0500, Michael R. Head wrote: > >> I assume you meant >> >> g_threads_init(); >> gdk_threads_init(); >> gtk_init(); >> >> gdk_threads_enter(); >> gtk_main(); >> gdk_threads_leave(); >> >> right? >> Yes, that i

Re: Multi-threaded UI Freezes on GDK Call

2007-12-18 Thread Michael R. Head
On Tue, 2007-12-18 at 17:14 -0500, Michael R. Head wrote: > On Tue, 2007-12-18 at 16:45 -0500, Michael McCann wrote: > > I've got a multithreaded GTK application. One thread runs gtk_main(): > > > > gtk_threads_enter(); > > gtk_main(); > > gtk_threads_leave(); > > I assume you meant > > >

Re: Multi-threaded UI Freezes on GDK Call

2007-12-18 Thread Michael R. Head
On Tue, 2007-12-18 at 16:45 -0500, Michael McCann wrote: > I've got a multithreaded GTK application. One thread runs gtk_main(): > > gtk_threads_enter(); > gtk_main(); > gtk_threads_leave(); I assume you meant g_threads_init(); gdk_threads_init(); gtk_init(); gdk_threads_e

Re: Multi-threaded UI Freezes on GDK Call

2007-12-18 Thread G Hasse
On Tue, Dec 18, 2007 at 04:45:50PM -0500, Michael McCann wrote: > I've got a multithreaded GTK application. One thread runs gtk_main(): > > gtk_threads_enter(); > gtk_main(); > gtk_threads_leave(); > > > The other thread is an infinite loop that sleeps for one second on each > loop. Every x seco

Multi-threaded UI Freezes on GDK Call

2007-12-18 Thread Michael McCann
I've got a multithreaded GTK application. One thread runs gtk_main(): gtk_threads_enter(); gtk_main(); gtk_threads_leave(); The other thread is an infinite loop that sleeps for one second on each loop. Every x seconds, the infinite loop calls a function, which makes some GDK calls. At the begin