aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/iomgr/tcp_posix.cc
diff options
context:
space:
mode:
authorGravatar Guantao Liu <guantaol@google.com>2018-11-26 14:39:49 -0800
committerGravatar Guantao Liu <guantaol@google.com>2018-11-26 14:39:49 -0800
commit9bbda894cbd845cea48a76c536d9731436c6313f (patch)
tree03e53be9ffb585617dbdc46b77d0df98414226bd /src/core/lib/iomgr/tcp_posix.cc
parent458d9d28dbe71b48986e9a296192bd92c0bb7936 (diff)
Use a static local flag to memorize whether the grpc event engine runs in background or not
Diffstat (limited to 'src/core/lib/iomgr/tcp_posix.cc')
-rw-r--r--src/core/lib/iomgr/tcp_posix.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/core/lib/iomgr/tcp_posix.cc b/src/core/lib/iomgr/tcp_posix.cc
index c802fcca75..4d9a66e82c 100644
--- a/src/core/lib/iomgr/tcp_posix.cc
+++ b/src/core/lib/iomgr/tcp_posix.cc
@@ -260,7 +260,10 @@ static void notify_on_write(grpc_tcp* tcp) {
if (grpc_tcp_trace.enabled()) {
gpr_log(GPR_INFO, "TCP:%p notify_on_write", tcp);
}
- if (grpc_event_engine_run_in_background()) {
+
+ static bool grpc_event_engine_run_in_background =
+ grpc_event_engine_run_in_background();
+ if (grpc_event_engine_run_in_background) {
// If there is a polling engine always running in the background, there is
// no need to run the backup poller.
GRPC_CLOSURE_INIT(&tcp->write_done_closure, tcp_handle_write, tcp,