BiteTheDDDDt commented on code in PR #2934:
URL: https://github.com/apache/brpc/pull/2934#discussion_r2029638078


##########
src/bthread/task_group.cpp:
##########
@@ -372,11 +372,12 @@ void TaskGroup::task_runner(intptr_t skip_remained) {
         // Clean tls variables, must be done before changing version_butex
         // otherwise another thread just joined this thread may not see side
         // effects of destructing tls variables.
-        KeyTable* kt = tls_bls.keytable;
+        LocalStorage* tls_bls_ptr = 
BAIDU_GET_PTR_VOLATILE_THREAD_LOCAL(tls_bls);
+        KeyTable* kt = tls_bls_ptr->keytable;
         if (kt != NULL) {
             return_keytable(m->attr.keytable_pool, kt);
             // After deletion: tls may be set during deletion.
-            tls_bls.keytable = NULL;
+            tls_bls_ptr->keytable = NULL;

Review Comment:
   return_keytable里有哪个操作是会切换pthread的吗?我看了一下貌似里面只有一些锁之类的东西。
   另外return_keytable处理的这个kt,是属于前面取到的tls的,如果后面设置null设置了另一个不同tls,似乎显得有点奇怪?



-- 
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: dev-unsubscr...@brpc.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org

Reply via email to