tools/show_twemproxies_stats/show_twem_stats.c
/* Wait for milliseconds until the given file descriptor becomes
 * writable/readable/exception */
Wait for milliseconds until the given file descriptor becomes
writable/readable/exception
Wait for milliseconds until the given file descriptor becomes writable / readable / exception
int pollWait(int fd, int mask, long long milliseconds) {
    struct pollfd pfd;
    int retmask = 0, retval;
    memset(&pfd, 0, sizeof(pfd));
    pfd.fd = fd;
    if (mask & POLL_READABLE) pfd.events |= POLLIN;
    if (mask & POLL_WRITABLE) pfd.events |= POLLOUT;
    if ((retval = poll(&pfd, 1, milliseconds))== 1) {
        if (pfd.revents & POLLIN) retmask |= POLL_READABLE;
        if (pfd.revents & POLLOUT) retmask |= POLL_WRITABLE;
    if (pfd.revents & POLLERR) retmask |= POLL_WRITABLE;
        if (pfd.revents & POLLHUP) retmask |= POLL_WRITABLE;
        return retmask;
    } else {
        return retval;
    }
}
int pollWait ( int fd , int mask , long long milliseconds ) { struct pollfd pfd ; int retmask = 0 , retval ; memset ( & pfd , 0 , sizeof ( pfd ) ) ; pfd . fd = fd ; if ( mask & POLL_READABLE ) pfd . events |= POLLIN ; if ( mask & POLL_WRITABLE ) pfd . events |= POLLOUT ; if ( ( retval = poll ( & pfd , 1 , milliseconds ) ) == 1 ) { if ( pfd . revents & POLLIN ) retmask |= POLL_READABLE ; if ( pfd . revents & POLLOUT ) retmask |= POLL_WRITABLE ; if ( pfd . revents & POLLERR ) retmask |= POLL_WRITABLE ; if ( pfd . revents & POLLHUP ) retmask |= POLL_WRITABLE ; return retmask ; } else { return retval ; } }
Wait for milliseconds until the given file descriptor becomes
 writable/readable/exception
Wait for milliseconds until the given file descriptor becomes writable / readable / exception