2 * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
4 * $Id: inputReady.c,v 1.2 2001/07/31 11:51:09 simonmar Exp $
6 * hReady Runtime Support
9 /* select and supporting types is not */
11 #define NON_POSIX_SOURCE
17 * inputReady(fd) checks to see whether input is available on the file
18 * descriptor 'fd'. Input meaning 'can I safely read at least a
19 * *character* from this file object without blocking?'
22 inputReady(int fd, int msecs)
24 #ifndef mingw32_TARGET_OS
30 #ifdef mingw32_TARGET_OS
36 /* select() will consider the descriptor set in the range of 0 to
40 tv.tv_sec = msecs / 1000;
41 tv.tv_usec = msecs % 1000;
43 while ((ready = select(maxfd, &rfd, NULL, NULL, &tv)) < 0 ) {
44 if (errno != EINTR ) {
49 /* 1 => Input ready, 0 => not ready, -1 => error */