aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/iomgr/ev_epollex_linux.c
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2017-04-06 16:13:41 -0700
committerGravatar Craig Tiller <ctiller@google.com>2017-04-06 16:13:41 -0700
commita74808604a03682108fc4a6d72384f1f5216849c (patch)
treec90367f319ccc1981ad3192938790724130b887b /src/core/lib/iomgr/ev_epollex_linux.c
parentb15f22102837f2b7d20e24b1903e0bcb742bfda9 (diff)
Fix pollset_init to also add the wakeup fd
Diffstat (limited to 'src/core/lib/iomgr/ev_epollex_linux.c')
-rw-r--r--src/core/lib/iomgr/ev_epollex_linux.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/core/lib/iomgr/ev_epollex_linux.c b/src/core/lib/iomgr/ev_epollex_linux.c
index 0985755a43..839807c246 100644
--- a/src/core/lib/iomgr/ev_epollex_linux.c
+++ b/src/core/lib/iomgr/ev_epollex_linux.c
@@ -465,8 +465,16 @@ static void pollset_init(grpc_pollset *pollset, gpr_mu **mu) {
pollset->num_pollers = 0;
gpr_atm_no_barrier_store(&pollset->shutdown_atm, 0);
pollset->shutdown_closure = NULL;
- GRPC_LOG_IF_ERROR("pollset_init",
- grpc_wakeup_fd_init(&pollset->pollset_wakeup));
+ if (GRPC_LOG_IF_ERROR("pollset_init",
+ grpc_wakeup_fd_init(&pollset->pollset_wakeup)) &&
+ pollset->epfd >= 0) {
+ struct epoll_event ev = {.events = EPOLLIN | EPOLLET,
+ .data.ptr = &pollset->pollset_wakeup};
+ if (epoll_ctl(pollset->epfd, EPOLL_CTL_ADD, pollset->pollset_wakeup.read_fd,
+ &ev) != 0) {
+ GRPC_LOG_IF_ERROR("pollset_init", GRPC_OS_ERROR(errno, "epoll_ctl"));
+ }
+ }
pollset->root_worker = NULL;
*mu = &pollset->mu;
}