aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/iomgr/timer_uv.cc
diff options
context:
space:
mode:
authorGravatar Yash Tibrewal <yashkt@google.com>2017-12-06 09:47:54 -0800
committerGravatar GitHub <noreply@github.com>2017-12-06 09:47:54 -0800
commit8cf1470a51ea276ca84825e7495d4ee24743540d (patch)
tree72385cc865094115bc08cb813201d48cb09840bb /src/core/lib/iomgr/timer_uv.cc
parent1d4e99508409be052bd129ba507bae1fbe7eb7fa (diff)
Revert "Revert "All instances of exec_ctx being passed around in src/core removed""
Diffstat (limited to 'src/core/lib/iomgr/timer_uv.cc')
-rw-r--r--src/core/lib/iomgr/timer_uv.cc26
1 files changed, 12 insertions, 14 deletions
diff --git a/src/core/lib/iomgr/timer_uv.cc b/src/core/lib/iomgr/timer_uv.cc
index fac2026fa9..5d238da089 100644
--- a/src/core/lib/iomgr/timer_uv.cc
+++ b/src/core/lib/iomgr/timer_uv.cc
@@ -42,28 +42,27 @@ 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_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_core::ExecCtx exec_ctx;
GRPC_UV_ASSERT_SAME_THREAD();
GPR_ASSERT(timer->pending);
timer->pending = 0;
- GRPC_CLOSURE_SCHED(&exec_ctx, timer->closure, GRPC_ERROR_NONE);
+ GRPC_CLOSURE_SCHED(timer->closure, GRPC_ERROR_NONE);
stop_uv_timer(handle);
- grpc_exec_ctx_finish(&exec_ctx);
}
-void grpc_timer_init(grpc_exec_ctx* exec_ctx, grpc_timer* timer,
- grpc_millis deadline, grpc_closure* closure) {
+void grpc_timer_init(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_exec_ctx_now(exec_ctx)) {
+ if (deadline <= grpc_core::ExecCtx::Get()->Now()) {
timer->pending = 0;
- GRPC_CLOSURE_SCHED(exec_ctx, timer->closure, GRPC_ERROR_NONE);
+ GRPC_CLOSURE_SCHED(timer->closure, GRPC_ERROR_NONE);
return;
}
timer->pending = 1;
- timeout = (uint64_t)(deadline - grpc_exec_ctx_now(exec_ctx));
+ timeout = (uint64_t)(deadline - grpc_core::ExecCtx::Get()->Now());
uv_timer = (uv_timer_t*)gpr_malloc(sizeof(uv_timer_t));
uv_timer_init(uv_default_loop(), uv_timer);
uv_timer->data = timer;
@@ -77,22 +76,21 @@ void grpc_timer_init(grpc_exec_ctx* exec_ctx, grpc_timer* timer,
void grpc_timer_init_unset(grpc_timer* timer) { timer->pending = 0; }
-void grpc_timer_cancel(grpc_exec_ctx* exec_ctx, grpc_timer* timer) {
+void grpc_timer_cancel(grpc_timer* timer) {
GRPC_UV_ASSERT_SAME_THREAD();
if (timer->pending) {
timer->pending = 0;
- GRPC_CLOSURE_SCHED(exec_ctx, timer->closure, GRPC_ERROR_CANCELLED);
+ GRPC_CLOSURE_SCHED(timer->closure, GRPC_ERROR_CANCELLED);
stop_uv_timer((uv_timer_t*)timer->uv_timer);
}
}
-grpc_timer_check_result grpc_timer_check(grpc_exec_ctx* exec_ctx,
- grpc_millis* next) {
+grpc_timer_check_result grpc_timer_check(grpc_millis* next) {
return GRPC_TIMERS_NOT_CHECKED;
}
-void grpc_timer_list_init(grpc_exec_ctx* exec_ctx) {}
-void grpc_timer_list_shutdown(grpc_exec_ctx* exec_ctx) {}
+void grpc_timer_list_init() {}
+void grpc_timer_list_shutdown() {}
void grpc_timer_consume_kick(void) {}