Polling is bad...



Hi -

Just FYI, "running another function in the background... to be called every
some  milliseconds..." can be *extremely* detrimental to performance.  It could
easily make your program a *very* unpleasant thing to be running in a
production environment.

Often times, there's no way to avoid it.  But please consider other
alternatives first, and invoke your function *only* as a last resort, if there
is *no* other way you can think of to use asynchronous notification instead of
polling.

Here's a discussion of a GTK+ application that successfully manages the down
side of polling:

http://www.usenix.org/event/usenix02/tech/freenix/full_papers/goel/goel_html/



Date: Fri, 15 Jul 2005 08:47:58 -0400
From: zhanglei <zhanglei sict ac cn>
Subject: Re: what is the function name that you can send a function to
      be running every n milliseconds
To: y g <odysseus lost gmail com>
Cc: gtk-app-devel-list gnome org
Message-ID: <42D7B07E 8010805 sict ac cn>
Content-Type: text/plain; charset=us-ascii; format=flowed

y g wrote:

Hello,

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...

Cheers
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

 

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 .




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