aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar Craig Tiller <craig.tiller@gmail.com>2015-05-15 17:11:44 -0700
committerGravatar Craig Tiller <craig.tiller@gmail.com>2015-05-17 14:35:29 -0700
commit6bf450149b878ad63b7c7ee9aa3e84e20a5c3024 (patch)
tree2af80516b2eff6d13eb6cb1cce264c6dcda5324a /src/core
parent4751fb1e462bcb0835aba24921cdfe4921fd4e85 (diff)
Kick the tire down the road instead of blocking to free up threads
Diffstat (limited to 'src/core')
-rw-r--r--src/core/iomgr/pollset_posix.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/core/iomgr/pollset_posix.c b/src/core/iomgr/pollset_posix.c
index 8ffc5e877e..6552b3f3b0 100644
--- a/src/core/iomgr/pollset_posix.c
+++ b/src/core/iomgr/pollset_posix.c
@@ -207,7 +207,6 @@ static void unary_poll_do_promote(void *args, int success) {
grpc_pollset *pollset = up_args->pollset;
grpc_fd *fd = up_args->fd;
int do_shutdown_cb = 0;
- gpr_free(up_args);
/*
* This is quite tricky. There are a number of cases to keep in mind here:
@@ -222,8 +221,12 @@ static void unary_poll_do_promote(void *args, int success) {
/* First we need to ensure that nobody is polling concurrently */
while (pollset->counter != 0) {
grpc_pollset_kick(pollset);
- gpr_cv_wait(&pollset->cv, &pollset->mu, gpr_inf_future);
+ grpc_iomgr_add_callback(unary_poll_do_promote, up_args);
+ gpr_mu_unlock(&pollset->mu);
+ return;
}
+
+ gpr_free(up_args);
/* At this point the pollset may no longer be a unary poller. In that case
* we should just call the right add function and be done. */
/* TODO(klempner): If we're not careful this could cause infinite recursion.