changeset 12713:16ce45dbcb53

ioloop: Use -1 for infinite poll/epoll timeout rather than INT_MAX. Should improve performance a tiny bit and also works around a CPU eater bug in Linux 2.6.37.
author Timo Sirainen <tss@iki.fi>
date Wed, 26 Jan 2011 21:47:52 +0200
parents fc02e620204d
children 7ec1982fb275
files src/lib/ioloop.c
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib/ioloop.c	Tue Jan 25 00:32:50 2011 +0200
+++ b/src/lib/ioloop.c	Wed Jan 26 21:47:52 2011 +0200
@@ -252,11 +252,12 @@
 	item = priorityq_peek(ioloop->timeouts);
 	timeout = (struct timeout *)item;
 	if (timeout == NULL) {
-		/* no timeouts. give it INT_MAX msecs. */
+		/* no timeouts. use INT_MAX msecs for timeval and
+		   return -1 for poll/epoll infinity. */
 		tv_r->tv_sec = INT_MAX / 1000;
 		tv_r->tv_usec = 0;
 		ioloop->next_max_time = (1ULL << (TIME_T_MAX_BITS-1)) - 1;
-		return INT_MAX;
+		return -1;
 	}
 
 	tv_now.tv_sec = 0;