Opened 8 years ago
Closed 8 years ago
#11049 closed Bugs (fixed)
lockfree::spsc_queue read/write_available unsafe
Reported by: | Owned by: | timblechmann | |
---|---|---|---|
Milestone: | To Be Determined | Component: | lockfree |
Version: | Boost 1.57.0 | Severity: | Problem |
Keywords: | Cc: |
Description
ringbuffer_base::read_available() and ringbuffer_base::write_available() both load write_index_ and read_index_ using relaxed memory order. read_available() should be used by the consumer, and thus should load write_index_ with memory_order_acquire. similarly, write_available() should be used by the producer, and thus should load read_index_ with memory_order_aquire. in addition, the comment for both functions is backwards, stating read_available() should only be called by the producer while write_available() should only be called by the consumer, which makes no sense. finally, the comment on front() is unclear in which thread is allowed to call it, but only the consumer can call front()
would you mind to submit a pull request on github?