Skip to content

Commit

Permalink
Add overload of rcu_retire that takes a unique_ptr
Browse files Browse the repository at this point in the history
Signed-off-by: Lance Roy <[email protected]>
  • Loading branch information
ldr709 committed Aug 2, 2017
1 parent edcc50e commit 215e029
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Test/paulmck/rcu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,9 @@ namespace std {
};

template<typename T, typename D = default_delete<T>>
void rcu_retire(T *p, D d = {})
void rcu_retire(std::unique_ptr<T, D> ptr)
{
typedef std::unique_ptr<T, D> ptr_type;
ptr_type ptr(p, std::move(d));

struct rcu_obj_base_ni :
public rcu_obj_base<rcu_obj_base_ni>,
public ptr_type {
Expand All @@ -118,4 +116,11 @@ namespace std {
(new rcu_obj_base_ni(std::move(ptr)))->retire();
}

template<typename T, typename D = default_delete<T>>
void rcu_retire(T *p, D d = {})
{
typedef std::unique_ptr<T, D> ptr_type;
rcu_retire(ptr_type(p, std::move(d)));
}

} // namespace std

0 comments on commit 215e029

Please sign in to comment.