[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: Multi-threaded UI Freezes on GDK Call
- From: G Hasse <gh raditex se>
- To: Michael McCann <naetrick comcast net>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Multi-threaded UI Freezes on GDK Call
- Date: Tue, 18 Dec 2007 22:52:23 +0100
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 seconds, the infinite loop calls a function, which makes
> some GDK calls. At the beginning of this function, gdk_threads_enter()
> is called; at the end, gdk_flush() and gdk_threads_leave() is called.
>
> Whenever this function is called, the UI freezes and CPU usage jumps to
> 100% for about one second (no other applications freeze, of course).
> I've tried calling gdk_threads_leave()/enter() before and after each GDK
> call to no avail. I run g_thread_init() and gdk_threads_init() at the
> beginning of my program.
>
> In the function, gdk_screen_get_default(), gdk_screen_get_root_window(),
> gdk_pixbuf_get_from_drawable(), and gdk_pixbuf_save_to_bufferv() are
> called.
>
> I'm using NetBSD on a P4 1.2GHz. What am I doing wrong? I've asked this
> question on IRC (irc.gnome.org, #gtk+) but noone seems to know the problem.
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 your
problem will go away...
> _______________________________________________
> gtk-app-devel-list mailing list
> gtk-app-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
--
Göran Hasse
----------------------------------------------------------------
Göran Hasse email: gh raditex se Tel: 08-6949270
Raditex AB http://www.raditex.se
Planiavägen 15, 1tr Mob: 070-5530148
131 34 NACKA, SWEDEN OrgNr: 556240-0589
VAT: SE556240058901
------------------------------------------------------------------
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]