aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/iomgr/exec_ctx.h
diff options
context:
space:
mode:
authorGravatar kpayson64 <kpayson@google.com>2018-06-20 15:18:38 -0700
committerGravatar kpayson64 <kpayson@google.com>2018-06-20 15:20:15 -0700
commit46a60590da056a556671d7a86a87c3ba0652ba89 (patch)
tree67d50df597b9db7b9357c1d51ed908d1853234f3 /src/core/lib/iomgr/exec_ctx.h
parent062f369c9cd28219981748f94830aa2f2b3cf95a (diff)
Changes
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 */