6 #ifndef XENIUM_DETAL_CONCURRENT_PTR_HPP
7 #define XENIUM_DETAL_CONCURRENT_PTR_HPP
9 #include <xenium/marked_ptr.hpp>
13 namespace xenium::reclamation::detail {
16 template <
class T, std::
size_t N,
template <
class,
class MarkedPtr>
class GuardPtr>
20 using guard_ptr = GuardPtr<T, marked_ptr>;
29 [[nodiscard]]
marked_ptr load(std::memory_order order = std::memory_order_seq_cst)
const {
return _ptr.load(order); }
32 void store(
const marked_ptr& src, std::memory_order order = std::memory_order_seq_cst) { _ptr.store(src, order); }
35 void store(
const guard_ptr& src, std::memory_order order = std::memory_order_seq_cst) {
36 _ptr.store(src.get(), order);
39 bool compare_exchange_weak(
marked_ptr& expected,
41 std::memory_order order = std::memory_order_seq_cst) {
42 return _ptr.compare_exchange_weak(expected, desired, order);
45 bool compare_exchange_weak(
marked_ptr& expected,
47 std::memory_order order = std::memory_order_seq_cst)
volatile {
48 return _ptr.compare_exchange_weak(expected, desired, order);
51 bool compare_exchange_weak(
marked_ptr& expected,
53 std::memory_order success,
54 std::memory_order failure) {
55 return _ptr.compare_exchange_weak(expected, desired, success, failure);
58 bool compare_exchange_weak(
marked_ptr& expected,
60 std::memory_order success,
61 std::memory_order failure)
volatile {
62 return _ptr.compare_exchange_weak(expected, desired, success, failure);
65 bool compare_exchange_strong(
marked_ptr& expected,
67 std::memory_order order = std::memory_order_seq_cst) {
68 return _ptr.compare_exchange_strong(expected, desired, order);
71 bool compare_exchange_strong(
marked_ptr& expected,
73 std::memory_order order = std::memory_order_seq_cst)
volatile {
74 return _ptr.compare_exchange_strong(expected, desired, order);
77 bool compare_exchange_strong(
marked_ptr& expected,
79 std::memory_order success,
80 std::memory_order failure) {
81 return _ptr.compare_exchange_strong(expected, desired, success, failure);
84 bool compare_exchange_strong(
marked_ptr& expected,
86 std::memory_order success,
87 std::memory_order failure)
volatile {
88 return _ptr.compare_exchange_strong(expected, desired, success, failure);
92 std::atomic<marked_ptr> _ptr;