aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/iomgr/exec_ctx.c
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2017-01-12 14:04:43 -0800
committerGravatar Craig Tiller <ctiller@google.com>2017-01-12 14:04:43 -0800
commit8cf88f1eb169f5bae7ddfbdd571fd4c27ba5e1bf (patch)
treeefed6075d073f85b3b916ecd2a975a6c9f3396f0 /src/core/lib/iomgr/exec_ctx.c
parent45d318351b398ed2231f82988af88ee13befaff4 (diff)
Add a mechanism for tagging threads that might be owned by
calls/channels Use it to ensure we don't delete the call from that thread: doing so would create a cycle that's kind of bad.
Diffstat (limited to 'src/core/lib/iomgr/exec_ctx.c')
-rw-r--r--src/core/lib/iomgr/exec_ctx.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/core/lib/iomgr/exec_ctx.c b/src/core/lib/iomgr/exec_ctx.c
index fabe6c6988..83bb436bd0 100644
--- a/src/core/lib/iomgr/exec_ctx.c
+++ b/src/core/lib/iomgr/exec_ctx.c
@@ -42,11 +42,16 @@
#include "src/core/lib/profiling/timers.h"
bool grpc_exec_ctx_ready_to_finish(grpc_exec_ctx *exec_ctx) {
- if (!exec_ctx->cached_ready_to_finish) {
- exec_ctx->cached_ready_to_finish = exec_ctx->check_ready_to_finish(
- exec_ctx, exec_ctx->check_ready_to_finish_arg);
+ if ((exec_ctx->flags & GRPC_EXEC_CTX_FLAG_IS_FINISHED) == 0) {
+ if (exec_ctx->check_ready_to_finish(exec_ctx,
+ exec_ctx->check_ready_to_finish_arg)) {
+ exec_ctx->flags |= GRPC_EXEC_CTX_FLAG_IS_FINISHED;
+ return true;
+ }
+ return false;
+ } else {
+ return true;
}
- return exec_ctx->cached_ready_to_finish;
}
bool grpc_never_ready_to_finish(grpc_exec_ctx *exec_ctx, void *arg_ignored) {
@@ -82,7 +87,7 @@ bool grpc_exec_ctx_flush(grpc_exec_ctx *exec_ctx) {
}
void grpc_exec_ctx_finish(grpc_exec_ctx *exec_ctx) {
- exec_ctx->cached_ready_to_finish = true;
+ exec_ctx->flags |= GRPC_EXEC_CTX_FLAG_IS_FINISHED;
grpc_exec_ctx_flush(exec_ctx);
}