17 #ifndef IOX_UTILS_CONCURRENT_LOFFLI_HPP
18 #define IOX_UTILS_CONCURRENT_LOFFLI_HPP
20 #include "iceoryx_utils/cxx/helplets.hpp"
21 #include "iceoryx_utils/internal/relocatable_pointer/relative_pointer.hpp"
33 using Index_t = uint32_t;
36 struct alignas(8) Node
38 Index_t indexToNextFreeIndex;
42 static_assert(
sizeof(Node) <= 8U,
43 "The size of 'Node' must not exceed 8 bytes in order to be lock-free on 64 bit systems!");
69 Index_t m_invalidIndex{0U};
70 std::atomic<Node> m_head{{0U, 1U}};
85 bool pop(Index_t& index) noexcept;
90 bool push(
const Index_t index) noexcept;
101 #include "loffli.inl"
Definition: loffli.hpp:31
static constexpr std::size_t requiredIndexMemorySize(const uint32_t capacity) noexcept
Definition: loffli.inl:24
void init(cxx::not_null< Index_t * > freeIndicesMemory, const uint32_t capacity) noexcept
bool pop(Index_t &index) noexcept
bool push(const Index_t index) noexcept
building block to easily create free function for logging in a library context
Definition: lockfree_queue.hpp:28
Definition: helplets.hpp:84