sockfilt.c: Reduce CPU load while running under a Windows PIPE

This commit is contained in:
Marc Hoersken 2013-04-06 19:05:16 +02:00
parent b4fae9d73f
commit 2ba0f1373c
1 changed files with 4 additions and 1 deletions

View File

@ -643,8 +643,11 @@ static int select_ws(int nfds, fd_set *readfds, fd_set *writefds,
/* check if there is no data from PIPE input */
if(!PeekNamedPipe(handle, NULL, 0, NULL, &avail, NULL))
avail = 0;
if(!avail)
if(!avail) {
FD_CLR(sock, readfds);
/* reduce CPU load */
Sleep(10);
}
} /* check if there is no data from keyboard input */
else if (!_kbhit()) {
/* check if there are INPUT_RECORDs in the input buffer */