Nullptr check

reviewable/pr20892/r1
Yash Tibrewal 5 years ago
parent 01ea1dea07
commit 2b8cd9a01b
  1. 36
      src/core/lib/iomgr/exec_ctx.cc

@ -176,24 +176,28 @@ grpc_millis ExecCtx::Now() {
void ExecCtx::Run(const DebugLocation& location, grpc_closure* closure,
grpc_error* error) {
if (closure != nullptr) {
#ifndef NDEBUG
if (closure->scheduled) {
gpr_log(GPR_ERROR,
"Closure already scheduled. (closure: %p, created: [%s:%d], "
"previously scheduled at: [%s: %d], newly scheduled at [%s: %d], "
"run?: %s",
closure, closure->file_created, closure->line_created,
closure->file_initiated, closure->line_initiated, location.file(),
location.line(), closure->run ? "true" : "false");
abort();
}
closure->scheduled = true;
closure->file_initiated = location.file();
closure->line_initiated = location.line();
closure->run = false;
GPR_ASSERT(closure->cb != nullptr);
if (closure->scheduled) {
gpr_log(GPR_ERROR,
"Closure already scheduled. (closure: %p, created: [%s:%d], "
"previously scheduled at: [%s: %d], newly scheduled at [%s: %d], "
"run?: %s",
closure, closure->file_created, closure->line_created,
closure->file_initiated, closure->line_initiated, location.file(),
location.line(), closure->run ? "true" : "false");
abort();
}
closure->scheduled = true;
closure->file_initiated = location.file();
closure->line_initiated = location.line();
closure->run = false;
GPR_ASSERT(closure->cb != nullptr);
#endif
exec_ctx_sched(closure, error);
exec_ctx_sched(closure, error);
} else {
GRPC_ERROR_UNREF(error);
}
}
} // namespace grpc_core

Loading…
Cancel
Save