[libcxx-commits] [libcxx] [libc++] P2530R3: Implementation of std::hazard_pointer (PR #218218)

Nikita Grivin via libcxx-commits libcxx-commits at lists.llvm.org
Mon Aug 24 02:22:50 PDT 2026


MindSpectre wrote:

@Zingam Thanks for the suggestions. The PR is still in draft. I ported a reference implementation of hazard pointers from Folly, and I still haven’t found all the artifacts left over from that process. I’m going to verify both ABI paths and C++ Standard conformance verbatim, even though the external contract is already being followed.

A couple of details I want to add: I guess I should file a separate issue for further improvements, such as an asymmetric fence. The asymmetric-fence proposal is expected to be approved for C++29, and the current implementation makes it easy to switch the trigger, which should significantly improve performance — roughly 3× according to my benchmarks.

I’ll also attach a benchmark matrix to the RFC comparing this implementation with Folly, along with a “possible improvements” section. For example, adding thread_local improves performance significantly, but I couldn’t find any examples of this semantic being used elsewhere in the library.

https://github.com/llvm/llvm-project/pull/218218


More information about the libcxx-commits mailing list