diff options
author | Noah Eisen <ncteisen@google.com> | 2017-11-13 17:16:56 -0800 |
---|---|---|
committer | Noah Eisen <ncteisen@google.com> | 2017-11-13 17:16:56 -0800 |
commit | 9268703dc974f35964e4b5c466f292b6300c0225 (patch) | |
tree | 5f33b03799c5d9b7d3012d0c5f7c84bdfb469af8 /src/core/lib/iomgr/timer_manager.cc | |
parent | b945cc443132c9f9797f1215e2d60bb051c07366 (diff) | |
parent | b0bad8f3864dc9c8745736fe68efe513b2b84932 (diff) |
Merge branch 'master' of https://github.com/grpc/grpc into inline-closure
Diffstat (limited to 'src/core/lib/iomgr/timer_manager.cc')
-rw-r--r-- | src/core/lib/iomgr/timer_manager.cc | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/core/lib/iomgr/timer_manager.cc b/src/core/lib/iomgr/timer_manager.cc index 16e9e7e707..acc40b6c9e 100644 --- a/src/core/lib/iomgr/timer_manager.cc +++ b/src/core/lib/iomgr/timer_manager.cc @@ -62,11 +62,11 @@ static uint64_t g_timed_waiter_generation; static void timer_thread(void* completed_thread_ptr); static void gc_completed_threads(void) { - if (g_completed_threads != NULL) { + if (g_completed_threads != nullptr) { completed_thread* to_gc = g_completed_threads; - g_completed_threads = NULL; + g_completed_threads = nullptr; gpr_mu_unlock(&g_mu); - while (to_gc != NULL) { + while (to_gc != nullptr) { gpr_thd_join(to_gc->t); completed_thread* next = to_gc->next; gpr_free(to_gc); @@ -225,6 +225,11 @@ static void timer_main_loop(grpc_exec_ctx* exec_ctx) { for (;;) { grpc_millis next = GRPC_MILLIS_INF_FUTURE; grpc_exec_ctx_invalidate_now(exec_ctx); + + /* Calibrate g_start_time in exec_ctx.cc with a regular interval in case the + * system clock has changed */ + grpc_exec_ctx_maybe_update_start_time(exec_ctx); + // check timer state, updates next to the next time to run a check switch (grpc_timer_check(exec_ctx, &next)) { case GRPC_TIMERS_FIRED: @@ -275,7 +280,7 @@ static void timer_thread(void* completed_thread_ptr) { // this threads exec_ctx: we try to run things through to completion here // since it's easy to spin up new threads grpc_exec_ctx exec_ctx = - GRPC_EXEC_CTX_INITIALIZER(0, grpc_never_ready_to_finish, NULL); + GRPC_EXEC_CTX_INITIALIZER(0, grpc_never_ready_to_finish, nullptr); timer_main_loop(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx); timer_thread_cleanup((completed_thread*)completed_thread_ptr); @@ -299,7 +304,7 @@ void grpc_timer_manager_init(void) { g_threaded = false; g_thread_count = 0; g_waiter_count = 0; - g_completed_threads = NULL; + g_completed_threads = nullptr; g_has_timed_waiter = false; g_timed_waiter_deadline = GRPC_MILLIS_INF_FUTURE; |