Re: what is the function name that you can send a function to be running every n milliseconds

On 7/15/05, zhanglei <zhanglei sict ac cn> wrote:
y g wrote:


I remember using some kind of function that allowed me to "send
another function to the background" and be called every some
milliseconds passed as parameter, but I can't remember its name or
where the documentation lies.... If someone has a quick answer to that
please help...

gtk-app-devel-list mailing list
gtk-app-devel-list gnome org

In file gtk-General.html of GTK+ Reference Manual(mainloop and events)
g_timeout_add( guint timeinterval, int (*func)(gpointer data), gpointer
data );

Maybe this is what you are finding .

Thank you all for your replies. Exactly that was what I've been
looking for... gtk_timeout_add or g_timeout_add since the first one is

One further question.... The function prototype of g_timeout_add is:
guint       g_timeout_add                   (guint interval,
                                             GSourceFunc function,
                                             gpointer data);

1. If function takes more that one argument how do I pass them in the
gpointer data...

lala(gint a, gint b)
  return a+b;

The following fails, which by the way gives me a warning that the
second argument is of incompatible pointer type (do I need a cast?):
g_timeout_add(100, lala, a, b);

So the only way that I can think of if I want to pass more than one
argument is to make a structure that holds the two integers and pass
that one as an argument to the function.

Is that correct?


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