32 Concurrency support library [thread]

32.11 Safe reclamation [saferecl]

32.11.3 Hazard pointers [saferecl.hp]

32.11.3.4 Class hazard_pointer [saferecl.hp.holder]

32.11.3.4.4 Non-member functions [saferecl.hp.holder.nonmem]

hazard_pointer make_hazard_pointer();
Effects: Constructs a hazard pointer.
Returns: A hazard_pointer object that owns the newly-constructed hazard pointer.
Throws: May throw bad_alloc if memory for the hazard pointer could not be allocated.
void swap(hazard_pointer& a, hazard_pointer& b) noexcept;
Effects: Equivalent to a.swap(b).
void make_hazard_pointer_batch(span<hazard_pointer> batch);
Effects: If an exception is thrown, there are no effects.
Otherwise, for each element e of batch such that e.empty() is true, constructs a hazard pointer and makes e the owner of that hazard pointer.
Throws: bad_alloc if memory for any of the newly-constructed hazard pointers could not be allocated.
void clear_hazard_pointer_batch(span<hazard_pointer> batch) noexcept;
Effects: For each element e of batch, if e.empty() is false, destroys the hazard pointer owned by e and makes e empty.