Multi-threaded UI Freezes on GDK Call
- From: Michael McCann <naetrick comcast net>
- To: gtk-app-devel-list gnome org
- Subject: Multi-threaded UI Freezes on GDK Call
- Date: Tue, 18 Dec 2007 16:45:50 -0500
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.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]