40 #ifndef LIBPMEMOBJ_CPP_MAKE_PERSISTENT_ARRAY_ATOMIC_HPP 41 #define LIBPMEMOBJ_CPP_MAKE_PERSISTENT_ARRAY_ATOMIC_HPP 50 #include <libpmemobj/atomic_base.h> 80 typedef typename detail::pp_array_type<T>::type I;
82 auto ret = pmemobj_xalloc(
pool.
handle(), ptr.raw_ptr(),
sizeof(I) * N,
83 detail::type_num<I>(), flag.value,
84 &detail::array_constructor<I>,
85 static_cast<void *>(&N));
88 throw std::bad_alloc();
105 template <
typename T>
108 pool_base &
pool,
typename detail::pp_if_size_array<T>::type &ptr,
111 typedef typename detail::pp_array_type<T>::type I;
112 std::size_t N = detail::pp_array_elems<T>::elems;
114 auto ret = pmemobj_xalloc(
pool.
handle(), ptr.raw_ptr(),
sizeof(I) * N,
115 detail::type_num<I>(), flag.value,
116 &detail::array_constructor<I>,
117 static_cast<void *>(&N));
120 throw std::bad_alloc();
133 template <
typename T>
142 pmemobj_free(ptr.raw_ptr());
154 template <
typename T>
162 pmemobj_free(ptr.raw_ptr());
Type of flag which can be passed to make_persistent_atomic.
Definition: allocation_flag.hpp:123
The non-template pool base class.
Definition: pool.hpp:67
PMEMobj pool class.
Definition: persistent_ptr.hpp:59
PMEMobjpool * handle() noexcept
Gets the C style handle to the pool.
Definition: pool.hpp:398
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:135
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:144
allocation_flag - defines flags which can be passed to make_persistent
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:75