After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 581258 - Please consider using g_timeout_add_seconds to reduce wakeups
Please consider using g_timeout_add_seconds to reduce wakeups
Status: RESOLVED DUPLICATE of bug 565315
Product: gnome-dictionary
Classification: Core
Component: general
git master
Other Linux
: Normal trivial
: ---
Assigned To: gnome-dictionary-maint
gnome-dictionary-maint
Depends on:
Blocks:
 
 
Reported: 2009-05-04 05:29 UTC by Javier Jardón (IRC: jjardon)
Modified: 2012-02-03 15:10 UTC
See Also:
GNOME target: ---
GNOME version: 2.27/2.28


Attachments
Use g_timeout_add_seconds instead g_timeout_add (3.96 KB, patch)
2009-05-04 05:36 UTC, Javier Jardón (IRC: jjardon)
reviewed Details | Review
Use g_timeout_add_seconds instead g_timeout_add in gdict functions (3.27 KB, patch)
2009-05-15 01:06 UTC, Javier Jardón (IRC: jjardon)
none Details | Review

Description Javier Jardón (IRC: jjardon) 2009-05-04 05:29:39 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.
Comment 1 Javier Jardón (IRC: jjardon) 2009-05-04 05:36:54 UTC
Created attachment 133901 [details] [review]
Use g_timeout_add_seconds instead g_timeout_add
Comment 2 Paolo Borelli 2009-05-04 08:06:06 UTC
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.
Comment 3 Javier Jardón (IRC: jjardon) 2009-05-04 10:31:15 UTC
Hello paolo, 

It would be great if you post any information for this question here: http://live.gnome.org/GnomeGoals/UseTimeoutAddSeconds 
Comment 4 Emmanuele Bassi (:ebassi) 2009-05-04 11:45:44 UTC
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.
Comment 5 Javier Jardón (IRC: jjardon) 2009-05-15 01:06:48 UTC
Created attachment 134675 [details] [review]
Use g_timeout_add_seconds instead g_timeout_add in gdict functions

Only patch gdict related functions
Comment 6 Javier Jardón (IRC: jjardon) 2009-08-10 21:23:05 UTC
ping :)
Comment 7 Luis Medinas 2011-05-14 01:37:56 UTC
There are more utils to use _add_seconds instead ? Was Javier patch commited ?
Comment 8 Robert Roth 2012-02-03 15:10:53 UTC
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 ***