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

2.9 KiB

[saferecl.hp.base]

32 Concurrency support library [thread]

32.11 Safe reclamation [saferecl]

32.11.3 Hazard pointers [saferecl.hp]

32.11.3.3 Class template hazard_pointer_obj_base [saferecl.hp.base]

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

1

#

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

2

#

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

3

#

D shall meet the requirements forCpp17DefaultConstructible and Cpp17MoveAssignable.

4

#

T may be an incomplete type.

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

🔗

void retire(D d = D()) noexcept;

5

#

Mandates: T is a hazard-protectable type.

6

#

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

x is not retired.

Move-assigning d to deleter does not exit via an exception.

7

#

Effects: Move-assigns d to deleter, thereby setting it as the deleter of x, then retires x.

May reclaim possibly-reclaimable objects.