wwbmmm commented on PR #3140:
URL: https://github.com/apache/brpc/pull/3140#issuecomment-3500877688

   > The span information is a tree structure, and this relationship is 
maintained through the ref information. For example, ParentSpan initially has 
ref=1, and two ClientSpans are created, so ref becomes 3.
   > 
   > When one ClientSpan returns, ref becomes 2; when the other ClientSpan 
returns, ref becomes 1. At this point, it can be destructed.
   
   Let me complement, the first reference to the ParentSpan is held by tls, 
when the bthread exit, ref_count will -1, when the ref_count become 0 (only 
after all ClientSpan return and the bthread exit) , it can be destructed.
   
   Moreover, when a new bthread with BTHREAD_INHERIT_SPAN is created, the 
ref_count will +1; when this bthread exit, the ref_count will -1.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to