[dovecot-cvs] dovecot/src/lib ioloop.c,1.44,1.45
tss at dovecot.org
tss at dovecot.org
Thu Mar 15 16:28:02 EET 2007
Update of /var/lib/cvs/dovecot/src/lib
In directory talvi:/tmp/cvs-serv11337
Modified Files:
ioloop.c
Log Message:
If timeout wait time was less than 1 millisecond, we wasted CPU calling
poll() (or whatever) with zero timeout multiple times until the millisecond
had passed. Now we round the waits up to next millisecond.
Index: ioloop.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/ioloop.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- ioloop.c 8 Mar 2007 22:04:21 -0000 1.44
+++ ioloop.c 15 Mar 2007 14:28:00 -0000 1.45
@@ -171,8 +171,10 @@
tv->tv_usec += 1000000;
}
- if (tv->tv_sec > 0 || (tv->tv_sec == 0 && tv->tv_usec > 0))
- return tv->tv_sec*1000 + tv->tv_usec/1000;
+ if (tv->tv_sec > 0 || (tv->tv_sec == 0 && tv->tv_usec > 0)) {
+ /* round wait times up to next millisecond */
+ return tv->tv_sec * 1000 + (tv->tv_usec + 999) / 1000;
+ }
/* no need to calculate the times again with this timeout */
tv->tv_sec = tv->tv_usec = 0;
More information about the dovecot-cvs
mailing list