On Sun, 2007-06-03 at 18:13 +0300, Timo Sirainen wrote:
I did once try to reduce these unnecessary wakeups, but then I thought it's probably not worth the trouble. No-one's going to run an IMAP server in their laptop.. :)
:)
My poor laptop is running a IMAP server, a HTTP server and a SMTP server.
This fixes it for imap/pop3-login: http://hg.dovecot.org/dovecot/rev/0021765627f3
Sweet, although this still wakes up when there are clients connected right?
Fixing dovecot-auth and dovecot processes is a bit more difficult. Patches welcome. :)
Maybe the optimal solution would be to create a new abstraction layer. Most of the timeout handlers are just checking for idle timeouts.
struct idle_timeout *idle_timeout_new(unsigned int secs, timeout_callback_t *callback, void *context); void idle_timeout_free(struct idle_timeout *idle); void idle_timeout_reset(struct idle_timeout *idle);
The code would internally keep just one timeout handler and whenever it's called, calculate the new time when it should be called.
Sounds like what GLib does. Glib also (in 2.13 onwards) lets you create timeouts with second-resolution, so that N timers that go off at roughly the same time do actually go off at the same time, meaning the application wakes up once instead of N times.
I presume porting Dovecot to use the glib main loop abstraction (which is nice and lean, the object system is a separate library) is out of the question?
Ross
Ross Burton mail: ross@burtonini.com jabber: ross@burtonini.com www: http://www.burtonini.com./ PGP Fingerprint: 1A21 F5B0 D8D0 CFE3 81D4 E25A 2D09 E447 D0B4 33DF