[Jack-Devel] Volatile vs memory fences

PrevNext  Index
DateSat, 05 Dec 2015 12:18:31 +0100
From Xavier Mendez <[hidden] at jmendeth dot com>
ToJACK <[hidden] at lists dot jackaudio dot org>
Follow-UpSean Bolton Re: [Jack-Devel] Volatile vs memory fences
I was reviewing the code for `jack_ringbuffer` and I saw it uses 
`volatile` for the pointers. This confused me, since my teachers have 
long insisted that `volatile` isn't for use on multithreaded code.

Take i.e. `jack_ringbuffer_write`: the hardware could reorder the writes 
so that the pointer is updated before the buffer has been written. 
Wouldn't a memory fence be required?

I appreciate your responses, I'm quite a noob when it comes to lock-free 
programming...

Thank you,
Xavi
PrevNext  Index

1449314320.25128_0.ltw:2, <5662C807.2020305 at jmendeth dot com>