Documentation Home

The jss::rcu_obj_base class template is intended as a base class for objects that will be reclaimed via RCU. By including some of the RCU management infrastructure directly in the object, this enables dynamic allocation of resources when retiring objects to be reduced.

The type of the Deleter is specified as a template parameter, and the deleter is initially constructed when the object is constructed, though this can later be replaced when the object is retired by a call to jss::rcu_obj_base::retire. jss::rcu_retire can still be used to register the object for reclamation, but doing so disables the optimizations available to jss::rcu_obj_base::retire.

The first template parameter, Derived is the type of the derived class. To use rcu_obj_base for a class X, X must be derived from rcu_obj_base<X,SomeDeleter>.

template <typename Derived, typename Deleter = std::default_delete<Derived>>
class rcu_obj_base {
    template <typename Deleter2>
    explicit rcu_obj_base(Deleter2 &&deleter);

    void retire();
    template <typename Deleter2> void retire(Deleter2 &&delete);
    Deleter stored_deleter; // Exposition only

#include <jss/rcu.hpp>

See Also