[libcxx-commits] [libcxx] [libc++] Implement P2545R4 Read-Copy Update (RCU) (PR #175451)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Aug 21 11:10:47 PDT 2026
================
@@ -0,0 +1,426 @@
+====================
+``<rcu>`` Design
+====================
+
+.. contents::
+ :local:
+ :depth: 2
+
+
+Introduction
+============
+
+This is the C++ paper `Read-Copy Update (RCU) <https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2545r4.pdf>`__.
+There are three designs discussed in the paper `Supplementary Material for User-Level Implementations of
+Read-Copy Update <http://www.rdrop.com/users/paulmck/RCU/urcu-supp-accepted.2011.08.30a.pdf>`__
+
+- Quiescent-State-Based Reclamation RCU
+- General-Purpose RCU
+- Low-Overhead RCU Via Signal Handling
+
+libc++ adopted a variation that closely resembles the "General-Purpose RCU" design in the above paper.
+
+Synopsis
+========
+::
+
+ class rcu_domain {
+ public:
+ void lock() noexcept;
+ bool try_lock() noexcept;
+ void unlock() noexcept;
+ };
+
+ rcu_domain& rcu_default_domain() noexcept;
+
+ void rcu_synchronize(rcu_domain& dom = rcu_default_domain()) noexcept;
----------------
ldionne wrote:
Since the Standard says explicitly whenever a public API may perform collection, and since they omit that from `rcu_synchronize`, I would argue that the design intent is clearly that `rcu_synchronize` does not perform any collection. I'm not certain whether that's actually the case, and I think it would be better if `rcu_synchronize` could say explicitly `may not evaluate scheduled evaluations`, but IMO the intent seems clear.
I think this could also be clarified with LWG.
https://eel.is/c++draft/saferecl#rcu.domain.func-2
https://github.com/llvm/llvm-project/pull/175451
More information about the libcxx-commits
mailing list