use BAIDU_VOLATILE_THREAD_LOCAL to declare tls_bls to avoid error compiler optimization#2934
Merged
chenBright merged 8 commits intoapache:masterfrom Apr 8, 2025
Merged
Conversation
Contributor
|
是否可以在访问tls_bls变量时使用 BAIDU_GET_VOLATILE_THREAD_LOCAL宏?这种方法应该更通用一些 |
Contributor
+1 |
Contributor
|
master已经修复了ci中cmake的问题,麻烦rebase一下。@BiteTheDDDDt |
chenBright
reviewed
Apr 4, 2025
yanglimingcn
pushed a commit
to yanglimingcn/brpc
that referenced
this pull request
May 19, 2025
…piler optimization (apache#2934) * add attribute noinline to tls_bls update * update * fix compile error * update * update * update
Contributor
|
请问下,这个有可复现的demo吗? |
Contributor
Author
这个是我在升级apache doris依赖的brpc版本的时候遇见的问题,没有单独的demo。我猜测可能BAIDU_VOLATILE_THREAD_LOCAL在你们的编译器或者平台下没起作用? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem does this PR solve?
解决bthread_setspecific注册的变量,用bthread_getspecific可能会找不到的问题。
Problem Summary:
根据 #1776 , #2156 里的一些相关描述,我尝试将清理tls这段代码抽出来作为单独函数并声明为noinline,在我自己的场景下测试可以修复这个问题
Changed:
Side effects:
Performance effects(性能影响):
Breaking backward compatibility(向后兼容性):
Check List: