diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2003-04-06 15:43:41 +0200 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2003-04-06 15:43:41 +0200 |
commit | 2a7dd5e67d621a2079b6bbbe47b3a4b6bba8a42b (patch) | |
tree | 5749d8661d07bac0bfc985e7b9cd3c21d87c452b /tools.c | |
parent | 3d90c8c4ee93f69b9ce363b8430a6ef76dc9d32c (diff) | |
download | vdr-2a7dd5e67d621a2079b6bbbe47b3a4b6bba8a42b.tar.gz vdr-2a7dd5e67d621a2079b6bbbe47b3a4b6bba8a42b.tar.bz2 |
Avoiding high CPU load in case the connection to LIRC gets lost
Diffstat (limited to 'tools.c')
-rw-r--r-- | tools.c | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: tools.c 1.76 2002/11/24 20:17:31 kls Exp $ + * $Id: tools.c 1.77 2003/04/06 15:31:45 kls Exp $ */ #include "tools.h" @@ -620,11 +620,13 @@ bool cFile::FileReady(int FileDes, int TimeoutMs) struct timeval timeout; FD_ZERO(&set); FD_SET(FileDes, &set); - if (TimeoutMs < 100) - TimeoutMs = 100; - timeout.tv_sec = TimeoutMs / 1000; - timeout.tv_usec = (TimeoutMs % 1000) * 1000; - return select(FD_SETSIZE, &set, NULL, NULL, &timeout) > 0 && FD_ISSET(FileDes, &set); + if (TimeoutMs >= 0) { + if (TimeoutMs < 100) + TimeoutMs = 100; + timeout.tv_sec = TimeoutMs / 1000; + timeout.tv_usec = (TimeoutMs % 1000) * 1000; + } + return select(FD_SETSIZE, &set, NULL, NULL, (TimeoutMs >= 0) ? &timeout : NULL) > 0 && FD_ISSET(FileDes, &set); } bool cFile::FileReadyForWriting(int FileDes, int TimeoutMs) |