Changeset View
Changeset View
Standalone View
Standalone View
src/rcu.h
Show First 20 Lines • Show All 97 Lines • ▼ Show 20 Lines | static RCUPtr acquire(T *&ptrIn) { | ||||
RCUPtr ret(ptrIn); | RCUPtr ret(ptrIn); | ||||
ptrIn = nullptr; | ptrIn = nullptr; | ||||
return ret; | return ret; | ||||
} | } | ||||
/** | /** | ||||
* Construct a new object that is owned by the pointer. | * Construct a new object that is owned by the pointer. | ||||
*/ | */ | ||||
template <typename... Args> static RCUPtr make(Args &&... args) { | template <typename... Args> static RCUPtr make(Args &&...args) { | ||||
return RCUPtr(new T(std::forward<Args>(args)...)); | return RCUPtr(new T(std::forward<Args>(args)...)); | ||||
} | } | ||||
/** | /** | ||||
* Construct a new RCUPtr without transferring owership. | * Construct a new RCUPtr without transferring owership. | ||||
*/ | */ | ||||
static RCUPtr copy(T *ptr) { | static RCUPtr copy(T *ptr) { | ||||
if (ptr != nullptr) { | if (ptr != nullptr) { | ||||
▲ Show 20 Lines • Show All 120 Lines • Show Last 20 Lines |