And the write like this:
TEMPLATE
inline bool CLASS::push(const Link& current, bytes& next,
const Link& index) NOEXCEPT
{
using namespace system;
const auto raw = file_.get_raw(link_to_position(index));
if (is_null(raw))
return false;
if constexpr (Align)
{
std::atomic_ref<integer> head(unsafe_byte_cast<integer>(raw));
next = Link(head.exchange(current, std::memory_order_acq_rel));
}
else
{
auto& head = to_array<size_>(raw);
mutex_.lock();
next = head;
head = current;
mutex_.unlock();
}
return true;
}