patch to use g_timeout_add_seconds()

Danny Kukawka danny.kukawka at web.de
Thu Feb 7 13:34:35 PST 2008


On Mittwoch, 6. Februar 2008, Sven Neumann wrote:
> Hi,
>
> as you probably know already, glib 2.14 introduced variants of the
> g_timeout_add() functions that operate at whole second granularity. This
> allows timers to be grouped, which results in a more power and CPU
> efficient behavior.
>
> Attached is a patch that adds a configure check for GLib 2.14 and
> changes some code (notably in the Linux specific parts) to use the new
> functions when possible. You will also find the patch online at
> http://sven.gimp.org/misc/hal-timeout-seconds.diff
>
> Please consider to include this. Thanks.

Without any testing: I would't do this:

+       g_timeout_add_seconds ((ACPI_POLL_INTERVAL * 120),
+                               battery_poll_infrequently,
+                               NULL);

The related code path is possibly CPU and time eating, you don't want have any 
other timeout synced with this one, since everything other can get 
delayed/stuck IIRC. At least this code/timer get only called ever hour, this 
is not that critical.

Could we get massive testing before add this to the next release?

Danny



More information about the hal mailing list