MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / aeWait

Function aeWait

src/ae.cpp:798–816  ·  view source on GitHub ↗

Wait for milliseconds until the given file descriptor becomes * writable/readable/exception */

Source from the content-addressed store, hash-verified

796/* Wait for milliseconds until the given file descriptor becomes
797 * writable/readable/exception */
798int 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
818void aeMain(aeEventLoop *eventLoop) {
819 eventLoop->stop = 0;

Callers 5

pipeModeFunction · 0.85
rewriteAppendOnlyFileFunction · 0.85
syncWriteFunction · 0.85
syncReadFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected