[libcxx-commits] [libcxx] [libc++] Implement P0718R2: `atomic<shared_ptr<T>>` (PR #78317)
Mark de Wever via libcxx-commits
libcxx-commits at lists.llvm.org
Sun Jan 21 10:57:44 PST 2024
mordante wrote:
Thanks for your contribution!
> Implements [P0718R2](https://wg21.link/P0718R2).
>
> This is quite a "dumb" implementation: It just reuses the now-deprecated functions in [[depr.util.smartptr.shared.atomic]](https://wg21.link/depr.util.smartptr.shared.atomic) on a held `std::{shared/weak}_ptr<T>` member.
Can you provide information why using deprecated features is the way to go? It seems likely these functions will be removed in C++26. Per [P2863R3](https://wg21.link/p2863r3) Review Annex D for C++26 (Alisdair Meredith)
"
6.24 Deprecated shared_ptr atomic access [depr.util.smartptr.shared.atomic]
The legacy C-style atomic API for manipulating shared pointers provided in C++11 is subtle, frequently misunderstood, and easily misused to cause data races. A type-safe replacement facility that also provides support for atomic<weak_ptr<T>> was added to C++20, so we recommend removing the legacy API at the earliest opportunity.
See paper [[P2869](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2863r3.html#ref-P2869)] for a more detailed discussion and proposed wording.
6.24.1 SG1 (concurrency) Review, 2023 June, Varna
Polled after discussion of the header compatibility concern:
Poll: Remove deprecated shared_ptr atomic access APIs from C++26, with any of the library options listed in P2689?
SF F N A SA
2 4 1 1 0
Consensus to move this paper to LEWG to resolve the header design issue, and then continue on to LWG.
"
https://github.com/llvm/llvm-project/pull/78317
More information about the libcxx-commits
mailing list