Make MPSCQ invariant thread-safe

This commit is contained in:
Matthew Parkinson
2021-12-17 12:12:32 +00:00
committed by Matthew Parkinson
parent 91d500baf8
commit 84ac360445

View File

@@ -63,7 +63,6 @@ namespace snmalloc
void invariant()
{
SNMALLOC_ASSERT(back != nullptr);
SNMALLOC_ASSERT(front != nullptr);
}
void init(freelist::HeadPtr stub)
@@ -140,6 +139,7 @@ namespace snmalloc
Cb cb)
{
invariant();
SNMALLOC_ASSERT(front != nullptr);
// Use back to bound, so we don't handle new entries.
auto b = back.load(std::memory_order_relaxed);