SDL_poll.h File Reference
`#include "../../SDL_internal.h"`
`#include "SDL_stdinc.h"`
Include dependency graph for SDL_poll.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Functions

int | SDL_IOReady (int fd, SDL_bool forWrite, int timeoutMS)

## Function Documentation

## SDL_IOReady()

int SDL_IOReady | ( | int | fd,
|  | SDL_bool | forWrite,
|  | int | timeoutMS
| ) |  |

Definition at line 38 of file SDL_poll.c.

References NULL, and SDL_assert.

{
int result;
/* Note: We don't bother to account for elapsed time if we get EINTR */
do
{
#ifdef HAVE_POLL
struct pollfd info;
info.fd = fd;
if (forWrite) {
info.events = POLLOUT;
} else {
info.events = POLLIN | POLLPRI;
}
result = poll(&info, 1, timeoutMS);
#else
fd_set rfdset, *rfdp = NULL;
fd_set wfdset, *wfdp = NULL;
struct timeval tv, *tvp = NULL;
/* If this assert triggers we'll corrupt memory here */
SDL_assert(fd >= 0 && fd < FD_SETSIZE);
if (forWrite) {
FD_ZERO(&wfdset);
FD_SET(fd, &wfdset);
wfdp = &wfdset;
} else {
FD_ZERO(&rfdset);
FD_SET(fd, &rfdset);
rfdp = &rfdset;
}
if (timeoutMS >= 0) {
tv.tv_sec = timeoutMS / 1000;
tv.tv_usec = (timeoutMS % 1000) * 1000;
tvp = &tv;
}
result = select(fd + 1, rfdp, wfdp, NULL, tvp);
#endif /* HAVE_POLL */
} while ( result < 0 && errno == EINTR );
return result;
}
result
GLuint64EXT * result
Definition: SDL_opengl_glext.h:9432
SDL_assert
#define SDL_assert(condition)
Definition: SDL_assert.h:169
NULL
#define NULL
Definition: begin_code.h:164
fd
GLuint64 GLenum GLint fd
Definition: gl2ext.h:1508