aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/iomgr/timer_manager.cc
diff options
context:
space:
mode:
authorGravatar Juanli Shen <aspirinsjl@gmail.com>2018-10-08 10:35:00 -0700
committerGravatar GitHub <noreply@github.com>2018-10-08 10:35:00 -0700
commit61b542f912507ca6b5389442645e2449b43a63d5 (patch)
treeea4d197692183e0666434669bd00cadb0979661a /src/core/lib/iomgr/timer_manager.cc
parent3f1c75208ec3e31d4b5285e4284f93589cafe5c7 (diff)
parenta51b44aa132f07401403e1bc16c388badd2e149b (diff)
Merge pull request #16750 from AspirinSJL/timer
Clean some timer code
Diffstat (limited to 'src/core/lib/iomgr/timer_manager.cc')
-rw-r--r--src/core/lib/iomgr/timer_manager.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/core/lib/iomgr/timer_manager.cc b/src/core/lib/iomgr/timer_manager.cc
index e272d228f8..54f19a9259 100644
--- a/src/core/lib/iomgr/timer_manager.cc
+++ b/src/core/lib/iomgr/timer_manager.cc
@@ -100,8 +100,7 @@ static void start_timer_thread_and_unlock(void) {
void grpc_timer_manager_tick() {
grpc_core::ExecCtx exec_ctx;
- grpc_millis next = GRPC_MILLIS_INF_FUTURE;
- grpc_timer_check(&next);
+ grpc_timer_check(nullptr);
}
static void run_some_timers() {
@@ -110,9 +109,12 @@ static void run_some_timers() {
// remove a waiter from the pool, and start another thread if necessary
--g_waiter_count;
if (g_waiter_count == 0 && g_threaded) {
+ // The number of timer threads is always increasing until all the threads
+ // are stopped. In rare cases, if a large number of timers fire
+ // simultaneously, we may end up using a large number of threads.
start_timer_thread_and_unlock();
} else {
- // if there's no thread waiting with a timeout, kick an existing
+ // if there's no thread waiting with a timeout, kick an existing untimed
// waiter so that the next deadline is not missed
if (!g_has_timed_waiter) {
if (grpc_timer_check_trace.enabled()) {