From ad4d2dde0052efbbf49d64b0843c45f0381cfeb3 Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Wed, 6 Dec 2017 09:05:05 -0800 Subject: Revert "All instances of exec_ctx being passed around in src/core removed" --- src/core/lib/iomgr/timer_uv.cc | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'src/core/lib/iomgr/timer_uv.cc') diff --git a/src/core/lib/iomgr/timer_uv.cc b/src/core/lib/iomgr/timer_uv.cc index 5d238da089..fac2026fa9 100644 --- a/src/core/lib/iomgr/timer_uv.cc +++ b/src/core/lib/iomgr/timer_uv.cc @@ -42,27 +42,28 @@ static void stop_uv_timer(uv_timer_t* handle) { void run_expired_timer(uv_timer_t* handle) { grpc_timer* timer = (grpc_timer*)handle->data; - grpc_core::ExecCtx exec_ctx; + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; GRPC_UV_ASSERT_SAME_THREAD(); GPR_ASSERT(timer->pending); timer->pending = 0; - GRPC_CLOSURE_SCHED(timer->closure, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(&exec_ctx, timer->closure, GRPC_ERROR_NONE); stop_uv_timer(handle); + grpc_exec_ctx_finish(&exec_ctx); } -void grpc_timer_init(grpc_timer* timer, grpc_millis deadline, - grpc_closure* closure) { +void grpc_timer_init(grpc_exec_ctx* exec_ctx, grpc_timer* timer, + grpc_millis deadline, grpc_closure* closure) { uint64_t timeout; uv_timer_t* uv_timer; GRPC_UV_ASSERT_SAME_THREAD(); timer->closure = closure; - if (deadline <= grpc_core::ExecCtx::Get()->Now()) { + if (deadline <= grpc_exec_ctx_now(exec_ctx)) { timer->pending = 0; - GRPC_CLOSURE_SCHED(timer->closure, GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED(exec_ctx, timer->closure, GRPC_ERROR_NONE); return; } timer->pending = 1; - timeout = (uint64_t)(deadline - grpc_core::ExecCtx::Get()->Now()); + timeout = (uint64_t)(deadline - grpc_exec_ctx_now(exec_ctx)); uv_timer = (uv_timer_t*)gpr_malloc(sizeof(uv_timer_t)); uv_timer_init(uv_default_loop(), uv_timer); uv_timer->data = timer; @@ -76,21 +77,22 @@ void grpc_timer_init(grpc_timer* timer, grpc_millis deadline, void grpc_timer_init_unset(grpc_timer* timer) { timer->pending = 0; } -void grpc_timer_cancel(grpc_timer* timer) { +void grpc_timer_cancel(grpc_exec_ctx* exec_ctx, grpc_timer* timer) { GRPC_UV_ASSERT_SAME_THREAD(); if (timer->pending) { timer->pending = 0; - GRPC_CLOSURE_SCHED(timer->closure, GRPC_ERROR_CANCELLED); + GRPC_CLOSURE_SCHED(exec_ctx, timer->closure, GRPC_ERROR_CANCELLED); stop_uv_timer((uv_timer_t*)timer->uv_timer); } } -grpc_timer_check_result grpc_timer_check(grpc_millis* next) { +grpc_timer_check_result grpc_timer_check(grpc_exec_ctx* exec_ctx, + grpc_millis* next) { return GRPC_TIMERS_NOT_CHECKED; } -void grpc_timer_list_init() {} -void grpc_timer_list_shutdown() {} +void grpc_timer_list_init(grpc_exec_ctx* exec_ctx) {} +void grpc_timer_list_shutdown(grpc_exec_ctx* exec_ctx) {} void grpc_timer_consume_kick(void) {} -- cgit v1.2.3