diff options
author | Craig Tiller <ctiller@google.com> | 2017-03-31 14:57:18 -0700 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2017-03-31 14:57:18 -0700 |
commit | a046ff1d95a58ffec653770498742e221ae27c5a (patch) | |
tree | ecd8fb448108ebcb89ef01062ac3a5ed6462385c /src/core | |
parent | ac50b27992697eaf806ad9a52332938c5f6b5c89 (diff) |
Restore old branch
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/lib/iomgr/timer_generic.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/core/lib/iomgr/timer_generic.c b/src/core/lib/iomgr/timer_generic.c index 497875a2f2..d8e6068431 100644 --- a/src/core/lib/iomgr/timer_generic.c +++ b/src/core/lib/iomgr/timer_generic.c @@ -477,8 +477,17 @@ static int run_some_expired_timers(grpc_exec_ctx *exec_ctx, gpr_atm now, g_shard_queue[0]->min_deadline); gpr_mu_unlock(&g_shared_mutables.mu); gpr_spinlock_unlock(&g_shared_mutables.checker_mu); - } else { - if (next != NULL) *next = GPR_MIN(*next, min_timer); + } else if (next != NULL) { + /* TODO(ctiller): this forces calling code to do an short poll, and + then retry the timer check (because this time through the timer list was + contended). + + We could reduce the cost here dramatically by keeping a count of how + many currently active pollers got through the uncontended case above + successfully, and waking up other pollers IFF that count drops to zero. + + Once that count is in place, this entire else branch could disappear. */ + *next = GPR_MIN(*next, now + 1); } GRPC_ERROR_UNREF(error); |