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:
@@ -117,6 +117,7 @@ typedef struct {
|
||||
|
||||
atomic_size_t committed;
|
||||
size_t commit_step;
|
||||
atomic_flag commit_lock;
|
||||
|
||||
MPMCSlot *slots;
|
||||
} MPMCQueue;
|
||||
|
||||
Reference in New Issue
Block a user