diff options
Diffstat (limited to 'src/core/lib/iomgr/closure.c')
-rw-r--r-- | src/core/lib/iomgr/closure.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/core/lib/iomgr/closure.c b/src/core/lib/iomgr/closure.c index 719e2e8cee..c1535fbabe 100644 --- a/src/core/lib/iomgr/closure.c +++ b/src/core/lib/iomgr/closure.c @@ -24,7 +24,9 @@ #include "src/core/lib/profiling/timers.h" -#ifdef GRPC_CLOSURE_RICH_DEBUG +grpc_tracer_flag grpc_trace_closure = GRPC_TRACER_INITIALIZER(false); + +#ifndef NDEBUG grpc_closure *grpc_closure_init(const char *file, int line, grpc_closure *closure, grpc_iomgr_cb_func cb, void *cb_arg, @@ -37,7 +39,7 @@ grpc_closure *grpc_closure_init(grpc_closure *closure, grpc_iomgr_cb_func cb, closure->cb = cb; closure->cb_arg = cb_arg; closure->scheduler = scheduler; -#ifdef GRPC_CLOSURE_RICH_DEBUG +#ifndef NDEBUG closure->scheduled = false; closure->file_initiated = NULL; closure->line_initiated = 0; @@ -112,7 +114,7 @@ static void closure_wrapper(grpc_exec_ctx *exec_ctx, void *arg, cb(exec_ctx, cb_arg, error); } -#ifdef GRPC_CLOSURE_RICH_DEBUG +#ifndef NDEBUG grpc_closure *grpc_closure_create(const char *file, int line, grpc_iomgr_cb_func cb, void *cb_arg, grpc_closure_scheduler *scheduler) { @@ -123,7 +125,7 @@ grpc_closure *grpc_closure_create(grpc_iomgr_cb_func cb, void *cb_arg, wrapped_closure *wc = gpr_malloc(sizeof(*wc)); wc->cb = cb; wc->cb_arg = cb_arg; -#ifdef GRPC_CLOSURE_RICH_DEBUG +#ifndef NDEBUG grpc_closure_init(file, line, &wc->wrapper, closure_wrapper, wc, scheduler); #else grpc_closure_init(&wc->wrapper, closure_wrapper, wc, scheduler); @@ -131,7 +133,7 @@ grpc_closure *grpc_closure_create(grpc_iomgr_cb_func cb, void *cb_arg, return &wc->wrapper; } -#ifdef GRPC_CLOSURE_RICH_DEBUG +#ifndef NDEBUG void grpc_closure_run(const char *file, int line, grpc_exec_ctx *exec_ctx, grpc_closure *c, grpc_error *error) { #else @@ -140,7 +142,7 @@ void grpc_closure_run(grpc_exec_ctx *exec_ctx, grpc_closure *c, #endif GPR_TIMER_BEGIN("grpc_closure_run", 0); if (c != NULL) { -#ifdef GRPC_CLOSURE_RICH_DEBUG +#ifndef NDEBUG c->file_initiated = file; c->line_initiated = line; c->run = true; @@ -153,7 +155,7 @@ void grpc_closure_run(grpc_exec_ctx *exec_ctx, grpc_closure *c, GPR_TIMER_END("grpc_closure_run", 0); } -#ifdef GRPC_CLOSURE_RICH_DEBUG +#ifndef NDEBUG void grpc_closure_sched(const char *file, int line, grpc_exec_ctx *exec_ctx, grpc_closure *c, grpc_error *error) { #else @@ -162,7 +164,7 @@ void grpc_closure_sched(grpc_exec_ctx *exec_ctx, grpc_closure *c, #endif GPR_TIMER_BEGIN("grpc_closure_sched", 0); if (c != NULL) { -#ifdef GRPC_CLOSURE_RICH_DEBUG +#ifndef NDEBUG GPR_ASSERT(!c->scheduled); c->scheduled = true; c->file_initiated = file; @@ -177,7 +179,7 @@ void grpc_closure_sched(grpc_exec_ctx *exec_ctx, grpc_closure *c, GPR_TIMER_END("grpc_closure_sched", 0); } -#ifdef GRPC_CLOSURE_RICH_DEBUG +#ifndef NDEBUG void grpc_closure_list_sched(const char *file, int line, grpc_exec_ctx *exec_ctx, grpc_closure_list *list) { #else @@ -186,7 +188,7 @@ void grpc_closure_list_sched(grpc_exec_ctx *exec_ctx, grpc_closure_list *list) { grpc_closure *c = list->head; while (c != NULL) { grpc_closure *next = c->next_data.next; -#ifdef GRPC_CLOSURE_RICH_DEBUG +#ifndef NDEBUG GPR_ASSERT(!c->scheduled); c->scheduled = true; c->file_initiated = file; |