On Thu, Jan 31, 2019 at 01:16:31PM +0800, fei phung wrote: > Hi, > > /* > * Filename: circ_ring.c > * Version: 1.0 > * Description: A circular buffer using API from > * https://github.com/torvalds/linux/blob/master/include/linux/ptr_ring.h > */ > > ptr_ring's void** queue is just giving data race problem, running > consume() together with [assignment of pointers+produce()] will > definitely give rise to data race > > mutex or lock cannot help in this case. Please correct me if wrong > > Regards, > Phung
I am not sure what does assignment of pointers mean in this context. ptr_ring is designed for a single producer and a single consumer. For why it works see explanation about data dependencies in Documentation/memory-barriers.txt. You will have to be more specific about the data race that you see if you expect more specific answers. Thanks, -- MST