Re: gtk threads



Xiong Huan wrote:
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;
}

I found that:

  gdk_threads_enter();
  gtk_main_iteration_do( FALSE );
  gdk_threads_leave();

is not needed. In my final post, the example
works without it (the label is shown ok).



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