aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/iomgr
diff options
context:
space:
mode:
authorGravatar Craig Tiller <craig.tiller@gmail.com>2015-03-06 23:01:38 -0800
committerGravatar David Klempner <klempner@google.com>2015-03-11 17:33:28 -0700
commita13752d8fde9b6b6bc00fc02a98c41b39fce0e3c (patch)
tree0cab7bc216e6be1a601cdc902d05864d1904adc1 /src/core/iomgr
parent6063b9ff526b293a389fa0377a59346c5bb222c1 (diff)
Remove the current poller from the watch list to avoid immediately kicking it when notifying of an event
Diffstat (limited to 'src/core/iomgr')
-rw-r--r--src/core/iomgr/pollset_multipoller_with_poll_posix.c4
-rw-r--r--src/core/iomgr/pollset_posix.c4
2 files changed, 6 insertions, 2 deletions
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;