Bug fixes in the lock free mpmc queue

Fix bug slots used before initialization,compare and swap is protecting
updating committed, but it is not protecting the memory initialization.
Adding atomic_flag commit_lock to protect against that

Fix bug multiple threads committing at the same time, fixed by using
atomic_flag commit_lock and re-checking committed after acquiring the
lock
This commit is contained in:
2026-03-07 10:29:48 +01:00
parent 4967591ff8
commit 0cf0d6c26a
4 changed files with 39 additions and 15 deletions

View File

@@ -13,3 +13,6 @@ v3.1: Lock free MPMC queue
v3.2: Making the lock free MPMC queue growable
Add padding to avoir false sharing
Add sleep() and SwitchToThread() to limit spinning
v3.3: Fix bug slots used before initialization,compare and swap is protecting updating committed, but it is not protecting the memory initialization. Adding atomic_flag commit_lock to protect against that
Fix bug multiple threads committing at the same time, fixed by using atomic_flag commit_lock and re-checking committed after acquiring the lock