lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 17/03/2012 7:11 PM, Gaspard Bucher wrote:
[1]
https://github.com/lubyk/lubyk/blob/master/modules/lk/include/lubyk/Fifo.h

With the exception of Visual C++2005 (and maybe later) where "volatile" also implies implicit memory barriers, the above linked code is not guaranteed to be safe.

Atomicity of the read and write pointers is not sufficient.

It is necessary to add processor memory barriers to ensure that the written data in the queue buffer is visible to the reader at the point that the reader sees the write pointer change.

Required memory barriers and barrier pairing will depend on the architecture.

Ross.