From a13752d8fde9b6b6bc00fc02a98c41b39fce0e3c Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 6 Mar 2015 23:01:38 -0800 Subject: Remove the current poller from the watch list to avoid immediately kicking it when notifying of an event --- src/core/iomgr/pollset_multipoller_with_poll_posix.c | 4 +++- src/core/iomgr/pollset_posix.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'src/core/iomgr') diff --git a/src/core/iomgr/pollset_multipoller_with_poll_posix.c b/src/core/iomgr/pollset_multipoller_with_poll_posix.c index 7570ff18c5..bcef7c35b5 100644 --- a/src/core/iomgr/pollset_multipoller_with_poll_posix.c +++ b/src/core/iomgr/pollset_multipoller_with_poll_posix.c @@ -172,6 +172,9 @@ static int multipoll_with_poll_pollset_maybe_work( } r = poll(h->pfds, h->pfd_count, timeout); + + end_polling(pollset); + if (r < 0) { if (errno != EINTR) { gpr_log(GPR_ERROR, "poll() failed: %s", strerror(errno)); @@ -192,7 +195,6 @@ static int multipoll_with_poll_pollset_maybe_work( } } grpc_pollset_kick_post_poll(&pollset->kick_state); - end_polling(pollset); gpr_mu_lock(&pollset->mu); pollset->counter = 0; diff --git a/src/core/iomgr/pollset_posix.c b/src/core/iomgr/pollset_posix.c index 0bb722e2b1..03fd94f136 100644 --- a/src/core/iomgr/pollset_posix.c +++ b/src/core/iomgr/pollset_posix.c @@ -396,6 +396,9 @@ static int unary_poll_pollset_maybe_work(grpc_pollset *pollset, pfd[1].events = grpc_fd_begin_poll(fd, pollset, POLLIN, POLLOUT, &fd_watcher); r = poll(pfd, GPR_ARRAY_SIZE(pfd), timeout); + + grpc_fd_end_poll(&fd_watcher); + if (r < 0) { if (errno != EINTR) { gpr_log(GPR_ERROR, "poll() failed: %s", strerror(errno)); @@ -415,7 +418,6 @@ static int unary_poll_pollset_maybe_work(grpc_pollset *pollset, } grpc_pollset_kick_post_poll(&pollset->kick_state); - grpc_fd_end_poll(&fd_watcher); gpr_mu_lock(&pollset->mu); pollset->counter = 0; -- cgit v1.2.3