gtk_timeout_add

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

 



Hi

Let have two functions:

gint aaa(void) {

  gint func_id ;
  .....
  func_id = gtk_timeout_add(500,(GtkFunction)bbb,0) ;
  ...
  
}

gboolean  bbb(gpointer data) {
  g_print(" Hello world \n") ;
  return FALSE ;
}


so at the first look at the function aaa it seems that it makes 
a thread which is running of function bbb every half second.
But for the second look we see that it is not true - it is just calling 
a function bbb with the data=NULL. 
This way of calling functions has advantages: the function aaa "says" to
gtk "please call function bbb in half second". So during this half
second GTK has time to repaint, resize, .....  - good for timereal
performance. But now the question is:

  Is it possible that the function aaa() "says" to system GTK: 
"please execute function bbb() in max half second. If you (GTK) have
nothing to do please execute bbb() now"

OK now you can answer that then I should use gtk_idle_add instead of
gtk_timeout_add. 
I do not want to do that - because in case of gtk_idle_add the bbb()
function sometimes can be never executed. 
OK Some of you can say I should use gtk_idle_add with priorities:
but it somehow solved problem, but here I do not have this time
limitations: I dont know which priority to use in gtk_idle_add_priority
(or whatever name) to get max 500ms for calling the bbb() functions. 

OK does anybody knows how to solve it or maybe some suggestions.

Also - still - if somebody knows a good applications which uses threads
to update status of GTK windows - please tell me which one and maybe the
link to source ;-) 

Best regards
Zbigniew Wasik


_______________________________________________

gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux