Wait for milliseconds until the given file descriptor becomes * writable/readable/exception */
| 796 | /* Wait for milliseconds until the given file descriptor becomes |
| 797 | * writable/readable/exception */ |
| 798 | int aeWait(int fd, int mask, long long milliseconds) { |
| 799 | struct pollfd pfd; |
| 800 | int retmask = 0, retval; |
| 801 | |
| 802 | memset(&pfd, 0, sizeof(pfd)); |
| 803 | pfd.fd = fd; |
| 804 | if (mask & AE_READABLE) pfd.events |= POLLIN; |
| 805 | if (mask & AE_WRITABLE) pfd.events |= POLLOUT; |
| 806 | |
| 807 | if ((retval = poll(&pfd, 1, milliseconds))== 1) { |
| 808 | if (pfd.revents & POLLIN) retmask |= AE_READABLE; |
| 809 | if (pfd.revents & POLLOUT) retmask |= AE_WRITABLE; |
| 810 | if (pfd.revents & POLLERR) retmask |= AE_WRITABLE; |
| 811 | if (pfd.revents & POLLHUP) retmask |= AE_WRITABLE; |
| 812 | return retmask; |
| 813 | } else { |
| 814 | return retval; |
| 815 | } |
| 816 | } |
| 817 | |
| 818 | void aeMain(aeEventLoop *eventLoop) { |
| 819 | eventLoop->stop = 0; |
no outgoing calls
no test coverage detected