Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shared_ptr's increment/decrement use sequential consistency. #23177

Closed
horenmar opened this issue Mar 5, 2015 · 5 comments
Closed

shared_ptr's increment/decrement use sequential consistency. #23177

horenmar opened this issue Mar 5, 2015 · 5 comments
Assignees
Labels
bugzilla Issues migrated from bugzilla libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.

Comments

@horenmar
Copy link

horenmar commented Mar 5, 2015

Bugzilla Link 22803
Resolution FIXED
Resolved on Jul 08, 2016 03:03
Version unspecified
OS All
CC @mclow

Extended Description

Current shared_ptr implementation uses sequential consistency for reference counting, even though less strong atomics are good enough. This leads to suboptimal performance for platforms other than x86 (x64).

Relaxed and acq/rel atomics (for increment and decrement respectively) should be sufficient for thread safety. The reason it is currently implemented like this was that Clang at the time didn't support full range of C++11 atomics and noone ever got back to cleaning it up.

@horenmar
Copy link
Author

horenmar commented Mar 5, 2015

assigned to @mclow

@llvmbot
Copy link
Member

llvmbot commented Jun 22, 2015

Related Patch (that I should probably change to fix this):

http://reviews.llvm.org/D10406

@llvmbot
Copy link
Member

llvmbot commented Jul 7, 2015

Fixed in r241532.

@llvmbot
Copy link
Member

llvmbot commented Jul 8, 2016

Current shared_ptr implementation uses sequential consistency for reference
counting, even though less strong atomics are good enough. This leads to
suboptimal performance for platforms other than x86 (x64).

Relaxed and acq/rel atomics (for increment and decrement respectively)
should be sufficient for thread safety. The reason it is currently
implemented like this was that Clang at the time didn't support full range
of C++11 atomics and noone ever got back to cleaning it up.

Hi;candecrement() use relaxed atomics?

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 9, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

No branches or pull requests

3 participants