Re: gtk threads
- From: Xiong Huan <huan xiong motorola com>
- To: Todd Fisher <taf2 lehigh edu>
- Cc: Russell Shaw <rjshaw netspace net au>, gtk-app-devel-list gnome org
- Subject: Re: gtk threads
- Date: Fri, 16 Jul 2004 11:23:59 +0800
Can anybody help to explain a bit why it is necessary to call
gtk_main_iteration_do() in source_cb()? I think the customized event source
in above example and the built-in event source for X events have the same
priorities and they both have the chances to be executed when arrived.
However, if I commented out that line, the lable doesn't appeared.
BTW, it is not necessary to call gdk_threads_enter/leave in source_cb() since
source_db is actually called in event dispatching thread.
Thanks.
On Wednesday 14 July 2004 22:50, Todd Fisher wrote:
I left one other part out you need to also modify the source_cb
function:
static gboolean
source_cb(gpointer data)
{
g_printf("i:%d\n",*((gint*)data));
gdk_threads_enter();
gtk_main_iteration_do( FALSE );
gdk_threads_leave();
return TRUE;
}
hope this helps :-)
Todd Fisher wrote:
you need to initialize the gdk threads:
int main( int argc, char *argv[] )
{
g_thread_init(NULL);
gdk_threads_init();
gtk_init(&argc,&argv);
...
gdk_threads_enter();
gtk_main();
gdk_threads_leave();
}
Russell Shaw wrote:
Hi,
This test prog counts to 20 on the terminal window and should show
a GtkLabel "test" displayed in a GtkWindow.
With the thread code commented out as below, "test" is shown correct.
When the thread is allowed to run, the label is not shown. Why so?
Snip
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]