| 460 | } |
| 461 | |
| 462 | extern "C" void aeDeleteFileEvent(aeEventLoop *eventLoop, int fd, int mask) |
| 463 | { |
| 464 | serverAssert(g_eventLoopThisThread == NULL || g_eventLoopThisThread == eventLoop); |
| 465 | if (fd >= eventLoop->setsize) return; |
| 466 | aeFileEvent *fe = &eventLoop->events[fd]; |
| 467 | if (fe->mask == AE_NONE) return; |
| 468 | |
| 469 | /* We want to always remove AE_BARRIER if set when AE_WRITABLE |
| 470 | * is removed. */ |
| 471 | if (mask & AE_WRITABLE) mask |= AE_BARRIER; |
| 472 | |
| 473 | if (mask & AE_WRITABLE) mask |= AE_WRITE_THREADSAFE; |
| 474 | if (mask & AE_READABLE) mask |= AE_READ_THREADSAFE; |
| 475 | |
| 476 | aeApiDelEvent(eventLoop, fd, mask); |
| 477 | fe->mask = fe->mask & (~mask); |
| 478 | if (fd == eventLoop->maxfd && fe->mask == AE_NONE) { |
| 479 | /* Update the max fd */ |
| 480 | int j; |
| 481 | |
| 482 | for (j = eventLoop->maxfd-1; j >= 0; j--) |
| 483 | if (eventLoop->events[j].mask != AE_NONE) break; |
| 484 | eventLoop->maxfd = j; |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | extern "C" int aeGetFileEvents(aeEventLoop *eventLoop, int fd) { |
| 489 | if (fd >= eventLoop->setsize) return 0; |
no test coverage detected