fix: fix bthread_id_unlock failed in aarch64 cpu(fix issue #3083)#3084
Merged
Huixxi merged 1 commit intoapache:masterfrom Sep 15, 2025
Merged
Conversation
Contributor
Author
|
After this modification, no similar problem in issue #3083 occurs |
Contributor
Author
|
ref: #2156 |
3df9ea1 to
5aacb93
Compare
wwbmmm
reviewed
Sep 9, 2025
|
|
||
| inline LocalPool* get_or_new_local_pool() { | ||
| LocalPool* lp = _local_pool; | ||
| LocalPool* lp = BAIDU_GET_VOLATILE_THREAD_LOCAL(_local_pool); |
| } | ||
| BAIDU_SCOPED_LOCK(_change_thread_mutex); //avoid race with clear() | ||
| _local_pool = lp; | ||
| BAIDU_SET_VOLATILE_THREAD_LOCAL(_local_pool, lp); |
|
|
||
| inline LocalPool* get_or_new_local_pool() { | ||
| LocalPool* lp = _local_pool; | ||
| LocalPool* lp = BAIDU_GET_VOLATILE_THREAD_LOCAL(_local_pool); |
| } | ||
| BAIDU_SCOPED_LOCK(_change_thread_mutex); //avoid race with clear() | ||
| _local_pool = lp; | ||
| BAIDU_SET_VOLATILE_THREAD_LOCAL(_local_pool, lp); |
5aacb93 to
c1ac17a
Compare
Contributor
|
LGTM |
Contributor
|
Does this implementation and modification ensure that compilation on architectures other than aarch64 will not be affected? |
Contributor
Author
only gcc compilers under aarch64 and clang under any architectures will optimize the reading and writing of thread_local variables, so these two will be affected by this modification. It is implemented by different macro expansion of BAIDU_GET_VOLATILE_THREAD_LOCAL under different compilation conditions.For more detailed discussion, you can refer to #2156 |
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?
Issue Number: fix #3083
Problem Summary:
What is changed and the side effects?
Changed:
Side effects:
Performance effects:
Breaking backward compatibility:
Check List: