Files
2025-10-25 03:02:53 +03:00

3.7 KiB
Raw Permalink Blame History

[saferecl.rcu.base]

32 Concurrency support library [thread]

32.11 Safe reclamation [saferecl]

32.11.2 Read-copy update (RCU) [saferecl.rcu]

32.11.2.3 Class template rcu_obj_base [saferecl.rcu.base]

1

#

Objects of type T to be protected by RCU inherit from a specialization rcu_obj_base<T, D> for some D.

namespace std {template<class T, class D = default_delete>class rcu_obj_base {public:void retire(D d = D(), rcu_domain& dom = rcu_default_domain()) noexcept; protected: rcu_obj_base() = default; rcu_obj_base(const rcu_obj_base&) = default; rcu_obj_base(rcu_obj_base&&) = default; rcu_obj_base& operator=(const rcu_obj_base&) = default; rcu_obj_base& operator=(rcu_obj_base&&) = default; ~rcu_obj_base() = default; private: D deleter; // exposition only};}

2

#

The behavior of a program that adds specializations for rcu_obj_base is undefined.

3

#

T may be an incomplete type.

It shall be complete before any member of the resulting specialization ofrcu_obj_base is referenced.

4

#

D shall be a function object type ([function.objects]) for which, given a value d of type D and a value ptr of type T*, the expression d(ptr) is valid.

5

#

D shall meet the requirements forCpp17DefaultConstructible and Cpp17MoveAssignable.

6

#

If D is trivially copyable, all specializations of rcu_obj_base<T, D> are trivially copyable.

🔗

void retire(D d = D(), rcu_domain& dom = rcu_default_domain()) noexcept;

7

#

Mandates: T is an rcu-protectable type.

8

#

Preconditions: *this is a base class subobject of an object x of type T.

The member function rcu_obj_base<T, D>::retire was not invoked on x before.

The assignment to deleter does not exit via an exception.

9

#

Effects: Evaluates deleter = std::move(d) and schedules the evaluation of the expression deleter(
addressof(x)) in the domain dom; the behavior is undefined if that evaluation exits via an exception.

May invoke scheduled evaluations in dom.

[Note 1:

If such evaluations acquire resources held across any invocation ofretire on dom, deadlock can occur.

— end note]