GNOME Bugzilla – Bug 581258
Please consider using g_timeout_add_seconds to reduce wakeups
Last modified: 2012-02-03 15:10:53 UTC
From http://live.gnome.org/GnomeGoals/UseTimeoutAddSeconds, (and of course according to the gtk docs) using g_timeout_add_seconds is preferred over g_timeout_add if a timeout in seconds is desired.
Created attachment 133901 [details] [review] Use g_timeout_add_seconds instead g_timeout_add
g_timeout_add_seconds should not be used everywhere: it should only be used for recurring tasks (polling etc) since it's where power can be saved by reducing wake ups. For "one-shot" events the lack of precision worsen the user experience without any real gain. Most of the hunks in the above patch seems to fall in this second category, except maybe the first change to gdict, but I'll ket Emmanuele answer on that.
Hello paolo, It would be great if you post any information for this question here: http://live.gnome.org/GnomeGoals/UseTimeoutAddSeconds
timeout_add_seconds() is meant to be used to cause the minimum amount of wakeups and let the kernel coalesce multiple wakeups at the same time. this means that a 5 seconds timeout might actually occur at the (worst case scenario) 7 seconds marker, if other timeouts are scheduled for that delay. for the gdict patch, I agree that the connection timeout should use timeout_add_seconds(); the find pane automatic hiding may or may not. for gnome-screenshot absolutely not: we need a real timeout there. I'd agree with Paolo that timeouts that are invoked just once do not pose a significant difference, but I'd love to get an informed opinion from the kernel people.
Created attachment 134675 [details] [review] Use g_timeout_add_seconds instead g_timeout_add in gdict functions Only patch gdict related functions
ping :)
There are more utils to use _add_seconds instead ? Was Javier patch commited ?
Thanks for the bug report. This particular bug has already been reported into our bug tracking system, but please feel free to report any further bugs you find. *** This bug has been marked as a duplicate of bug 565315 ***