[RFC] P2530R3 std::hazard_pointer prototype

PaulXiCao paulxicao7@gmail.com
Mon May 25 18:57:45 GMT 2026


Hi all,

I have a prototype implementation of the C++26 <hazard_pointer>
facility (P2530R3) and would like feedback before porting it into
libstdc++ style.

  https://github.com/PaulXiCao/hazard_pointer_prototype

Single-header, namespace proto, full API surface
(hazard_pointer_obj_base, hazard_pointer, make_hazard_pointer). Builds
and tests pass under gcc-14/16, clang-21, MSVC; TSan and ASan clean.
README.md covers memory ordering rationale and the synchronize()
collect-then-snapshot ordering; PORTING_NOTES.md lists the
transformations still needed for libstdc++ (e.g. uglification,
_GLIBCXX_ macros, fine-grained <bits/...> includes, __gthread
primitives).

Any feedback welcome before I start the libstdc++ rewrite -- in
particular on the memory ordering choices, the synchronize() design,
and API surface conformance to P2530R3, but I am also interested in
anything else that catches your eye.

One open issue worth flagging: gcc -fcontracts ICEs on a defaulted
default constructor with a post() annotation. Filed as PR125403; the
prototype carries a small workaround.

Thanks,
Paul


More information about the Libstdc++ mailing list