g_idle_add_full and main loop



Hi,

I'm digging for an answer and I can't find it.

I Have two threads, but they are native Windows threads (I use 2.6.8
on winXP). One of them is standard GTK main loop, the other one is a
callback from external library. So i made it like


int func(data)
{
        gtk_label_set_text(GTK_LABEL(lab), "something");
        gdk_window_process_all_updates();
  return false;
}

callback()
{
 ..
  g_idle_add_full(G_PRIORITY_HIGH_IDLE, &func, NULL,NULL);
..
}


And It works... well sort off. func get called right away only if i
constantly move mouse pointer over my gtk application (i suspect this
triggers pending events). I want to have fired that func right away,
since it's a "progress" (its called about once for second).

Sorry if it's on mailing list but seraching "threads GUI" didn't bring
me detailed answer. In faq there is a "g_idle_add_full" trick like
this one but there is nothing about my problem with lazyness of that
approach.

I'm thinking of g_signal to main loop or something but.... well....
maybe there is an elegant solution.

Thx for any help...

-- 
Paweł Różański


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