Opened 8 years ago

Closed 8 years ago

#11049 closed Bugs (fixed)

lockfree::spsc_queue read/write_available unsafe

Reported by: Nate C <crzftx@…> 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()

Change History (3)

comment:1 by timblechmann, 8 years ago

would you mind to submit a pull request on github?

comment:2 by Nate C <crzftx@…>, 8 years ago

alright, I think I've done that now.

comment:3 by timblechmann, 8 years ago

Resolution: fixed
Status: newclosed

thnx!

Note: See TracTickets for help on using tickets.