aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/channel/channelz.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/lib/channel/channelz.cc')
-rw-r--r--src/core/lib/channel/channelz.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/core/lib/channel/channelz.cc b/src/core/lib/channel/channelz.cc
index f3d0c03715..33577d890a 100644
--- a/src/core/lib/channel/channelz.cc
+++ b/src/core/lib/channel/channelz.cc
@@ -43,8 +43,10 @@
namespace grpc_core {
namespace channelz {
-BaseNode::BaseNode(EntityType type)
- : type_(type), uuid_(ChannelzRegistry::Register(this)) {}
+BaseNode::BaseNode(EntityType type) : type_(type), uuid_(-1) {
+ // The registry will set uuid_ under its lock.
+ ChannelzRegistry::Register(this);
+}
BaseNode::~BaseNode() { ChannelzRegistry::Unregister(uuid_); }