11 #ifndef LIBPMEMOBJ_CPP_MAKE_PERSISTENT_ATOMIC_HPP 12 #define LIBPMEMOBJ_CPP_MAKE_PERSISTENT_ATOMIC_HPP 22 #include <libpmemobj/atomic_base.h> 48 template <
typename T,
typename... Args>
54 auto arg_pack = std::forward_as_tuple(std::forward<Args>(args)...);
55 auto ret = pmemobj_xalloc(
56 pool.
handle(), ptr.
raw_ptr(),
sizeof(T), detail::type_num<T>(),
58 &detail::obj_constructor<T, decltype(arg_pack), Args...>,
59 static_cast<void *
>(&arg_pack));
62 throw std::bad_alloc();
80 template <
typename T,
typename... Args>
82 Args...>::value>::type
88 std::forward<Args>(args)...);
101 template <
typename T>
110 pmemobj_free(ptr.raw_ptr());
void make_persistent_atomic(pool_base &pool, typename detail::pp_if_array< T >::type &ptr, std::size_t N, allocation_flag_atomic flag=allocation_flag_atomic::none())
Atomically allocate an array of objects.
Definition: make_persistent_array_atomic.hpp:46
Type of flag which can be passed to make_persistent_atomic.
Definition: allocation_flag.hpp:94
Persistent pointer class.
Definition: common.hpp:107
The non-template pool base class.
Definition: pool.hpp:46
void delete_persistent_atomic(typename detail::pp_if_array< T >::type &ptr, std::size_t)
Atomically deallocate an array of objects.
Definition: make_persistent_array_atomic.hpp:106
PMEMobj pool class.
Definition: persistent_ptr.hpp:30
PMEMobjpool * handle() noexcept
Gets the C style handle to the pool.
Definition: pool.hpp:398
Commonly used functionality.
Compile time type check for make_persistent.
Implementation details of atomic allocation and construction.
Helper functionality for handling variadic templates.
static allocation_flag_atomic none()
Do not change allocator behaviour.
Definition: allocation_flag.hpp:115
allocation_flag - defines flags which can be passed to make_persistent
PMEMoid * raw_ptr() noexcept
Get pointer to PMEMoid encapsulated by this object.
Definition: persistent_ptr_base.hpp:164
Atomic persistent_ptr allocation functions for arrays.
Persistent memory namespace.
Definition: allocation_flag.hpp:14