aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/iomgr/exec_ctx.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/lib/iomgr/exec_ctx.h')
-rw-r--r--src/core/lib/iomgr/exec_ctx.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/core/lib/iomgr/exec_ctx.h b/src/core/lib/iomgr/exec_ctx.h
index cf1118a003..8ddab0d381 100644
--- a/src/core/lib/iomgr/exec_ctx.h
+++ b/src/core/lib/iomgr/exec_ctx.h
@@ -45,6 +45,9 @@ typedef struct grpc_combiner grpc_combiner;
/* The exec_ctx's thread is (potentially) owned by a call or channel: care
should be given to not delete said call/channel from this exec_ctx */
#define GRPC_EXEC_CTX_FLAG_THREAD_RESOURCE_LOOP 2
+/* This exec ctx was initialized by an internal thread, and should not
+ be counted by fork handlers */
+#define GRPC_EXEC_CTX_FLAG_IS_INTERNAL_THREAD 4
extern grpc_closure_scheduler* grpc_schedule_on_exec_ctx;
@@ -93,7 +96,9 @@ class ExecCtx {
/** Parameterised Constructor */
ExecCtx(uintptr_t fl) : flags_(fl) {
- grpc_core::Fork::IncExecCtxCount();
+ if (!(GRPC_EXEC_CTX_FLAG_IS_INTERNAL_THREAD & flags_)) {
+ grpc_core::Fork::IncExecCtxCount();
+ }
Set(this);
}
@@ -102,7 +107,9 @@ class ExecCtx {
flags_ |= GRPC_EXEC_CTX_FLAG_IS_FINISHED;
Flush();
Set(last_exec_ctx_);
- grpc_core::Fork::DecExecCtxCount();
+ if (!(GRPC_EXEC_CTX_FLAG_IS_INTERNAL_THREAD & flags_)) {
+ grpc_core::Fork::DecExecCtxCount();
+ }
}
/** Disallow copy and assignment operators */