MCPcopy Create free account
hub / github.com/F-Stack/f-stack / aeWait

Function aeWait

app/redis-6.2.6/src/ae.c:469–487  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

467/* Wait for milliseconds until the given file descriptor becomes
468 * writable/readable/exception */
469int aeWait(int fd, int mask, long long milliseconds) {
470 struct pollfd pfd;
471 int retmask = 0, retval;
472
473 memset(&pfd, 0, sizeof(pfd));
474 pfd.fd = fd;
475 if (mask & AE_READABLE) pfd.events |= POLLIN;
476 if (mask & AE_WRITABLE) pfd.events |= POLLOUT;
477
478 if ((retval = poll(&pfd, 1, milliseconds))== 1) {
479 if (pfd.revents & POLLIN) retmask |= AE_READABLE;
480 if (pfd.revents & POLLOUT) retmask |= AE_WRITABLE;
481 if (pfd.revents & POLLERR) retmask |= AE_WRITABLE;
482 if (pfd.revents & POLLHUP) retmask |= AE_WRITABLE;
483 return retmask;
484 } else {
485 return retval;
486 }
487}
488
489void aeMain(aeEventLoop *eventLoop) {
490 aeProcessEvents(eventLoop, AE_ALL_EVENTS|

Callers 5

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

Calls 1

memsetFunction · 0.85

Tested by

no test coverage detected