gaim timeout_seconds patch

Richard Laager rlaager at wiktel.com
Sun May 20 13:23:05 EDT 2007


On Sun, 2007-05-20 at 12:01 -0500, Richard Laager wrote:
> I've merged this into my local 2.1.0 branch.

I didn't mean to send this to devel without an explanation.

The patch changes our multi-second timers to call a new
purple_timeout_add_seconds(), which calls a separate EventLoop UiOp.
This uses up one of the 4 reserved pointers there... Is that okay? I
don't think we'll be changing much else there.

A UI using the glib event loop would register g_timeout_add_seconds()
for this new UI op, if we have glib 2.14 or greater.

g_timeout_add_seconds() merges multiple timers to the same boundary, so
the CPU isn't waking up every few milliseconds to process separate
timers. Arjan explained it as follows:

arjan: image a 1 second interval like this
arjan: 0 |------------------------------------------------| 1
arjan: if your desktop has say 20 timers that fire "once per second" (or
       40 that fire once per 2 seconds) it'll be like this
arjan: 0 |--x----x----x--x--x---x---x----x-----x----x-----| 1
arjan: result is your cpu never sleeps very long
arjan: g_timeout_add_seconds() will use a bit of rounding to make it
       look like this
arjan: 0 |--xxxxx------------------------------------------| 1
arjan: so that you have short period of activity
arjan: and a nice long time where the cpu can powersave

Richard
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://pidgin.im/pipermail/devel/attachments/20070520/c9a2dc74/attachment.sig>


More information about the Devel mailing list