Merge pull request #18002 from soheilhy/pollset-review

Address guantaol@'s comments on Pull #17964
pull/18036/head
Soheil Hassas Yeganeh 6 years ago committed by GitHub
commit 2c93381e84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 16
      src/core/lib/iomgr/ev_epollex_linux.cc

@ -447,14 +447,12 @@ static void fd_orphan(grpc_fd* fd, grpc_closure* on_done, int* release_fd,
// Otherwise, we will receive epoll events after we release the FD.
epoll_event ev_fd;
memset(&ev_fd, 0, sizeof(ev_fd));
if (release_fd != nullptr) {
if (pollable_obj != nullptr) { // For PO_FD.
epoll_ctl(pollable_obj->epfd, EPOLL_CTL_DEL, fd->fd, &ev_fd);
}
for (size_t i = 0; i < fd->pollset_fds.size(); ++i) { // For PO_MULTI.
const int epfd = fd->pollset_fds[i];
epoll_ctl(epfd, EPOLL_CTL_DEL, fd->fd, &ev_fd);
}
if (pollable_obj != nullptr) { // For PO_FD.
epoll_ctl(pollable_obj->epfd, EPOLL_CTL_DEL, fd->fd, &ev_fd);
}
for (size_t i = 0; i < fd->pollset_fds.size(); ++i) { // For PO_MULTI.
const int epfd = fd->pollset_fds[i];
epoll_ctl(epfd, EPOLL_CTL_DEL, fd->fd, &ev_fd);
}
*release_fd = fd->fd;
} else {
@ -1295,7 +1293,7 @@ static grpc_error* pollset_as_multipollable_locked(grpc_pollset* pollset,
static void pollset_add_fd(grpc_pollset* pollset, grpc_fd* fd) {
GPR_TIMER_SCOPE("pollset_add_fd", 0);
// We never transition from PO_MULTI to other modes (i.e., PO_FD or PO_EMOPTY)
// We never transition from PO_MULTI to other modes (i.e., PO_FD or PO_EMPTY)
// and, thus, it is safe to simply store and check whether the FD has already
// been added to the active pollable previously.
if (gpr_atm_acq_load(&pollset->active_pollable_type) == PO_MULTI &&

Loading…
Cancel
Save