From 4d0269f0fdfe64912855f22481d77a5d710fb876 Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Tue, 7 Jul 2020 18:36:41 -0700 Subject: [PATCH] Add comment --- src/core/ext/filters/client_channel/client_channel.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/ext/filters/client_channel/client_channel.cc b/src/core/ext/filters/client_channel/client_channel.cc index f652a6113e6..43a3688e2ab 100644 --- a/src/core/ext/filters/client_channel/client_channel.cc +++ b/src/core/ext/filters/client_channel/client_channel.cc @@ -177,7 +177,9 @@ class ChannelData { MutexLock lock(&external_watchers_mu_); // Will be deleted when the watch is complete. GPR_ASSERT(external_watchers_[on_complete] == nullptr); - // Pass a ref to the external_watchers_ map. + // Pass a ref to the external_watchers_ map. We are taking an additional + // ref on the watcher so that we can maintain lifetime guarantees when + // watcher->Start() is called after the critical section. external_watchers_[on_complete] = watcher; } watcher->Start();