aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-03-26 10:38:40 +0000
committerEric Wong <normalperson@yhbt.net>2008-03-26 10:38:40 +0000
commitf9e317ccbde426182e0eca3fa0d55d46f89a330b (patch)
tree3a2d8dcc8de3852ad90c3b277c33803b89608960 /src
parentd78ddd1e50dae2038a0d3f742d45e17dee0bbe4b (diff)
downloadmpd-f9e317ccbde426182e0eca3fa0d55d46f89a330b.tar.gz
mpd-f9e317ccbde426182e0eca3fa0d55d46f89a330b.tar.xz
mpd-f9e317ccbde426182e0eca3fa0d55d46f89a330b.zip
unlimited select() timeout
mpd sets a 1s select() timeout for no reason. This makes mpd wake up the CPU, consume some cycles just to see there is nothing to do. We can save that by specifying NULL instead of a timeout. git-svn-id: https://svn.musicpd.org/mpd/trunk@7212 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r--src/interface.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/interface.c b/src/interface.c
index 0beffba23..f74d4d41a 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -478,14 +478,11 @@ int doIOForInterfaces(void)
fd_set rfds;
fd_set wfds;
fd_set efds;
- struct timeval tv;
+ struct timeval tv, *tvp = NULL;
int i;
int selret;
int fdmax;
- tv.tv_sec = 1;
- tv.tv_usec = 0;
-
while (1) {
fdmax = 0;
@@ -495,7 +492,7 @@ int doIOForInterfaces(void)
registered_IO_add_fds(&fdmax, &rfds, &wfds, &efds);
- selret = select(fdmax + 1, &rfds, &wfds, &efds, &tv);
+ selret = select(fdmax + 1, &rfds, &wfds, &efds, tvp);
if (selret < 0 && errno == EINTR)
break;
@@ -530,6 +527,7 @@ int doIOForInterfaces(void)
tv.tv_sec = 0;
tv.tv_usec = 0;
+ tvp = &tv;
}
return 1;