From 9ff024638620a6b2ba9cdd77e7d7db68516ecdac Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 5 Sep 2008 00:37:17 -0700 Subject: audio_format: volatile removal volatile provides absolutely no guarantee thread-safety in SMP environments. volatile was designed to access memory locations in peripheral hardware directly; not for SMP. If volatile is needed to work properly on SMP, then it is only hiding subtle bugs. volatile only prevents the /compiler/ from making optimizations when accessing variables. CPUs do their own optimizations at runtime so it cannot guarantee registers of CPUs are flushed to memory cache-coherent access on different CPUs. Furthermore, the thread-communication via condition variables between threads sharing audio formats already results in memory barriers. --- src/audio_format.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/audio_format.h') diff --git a/src/audio_format.h b/src/audio_format.h index a6e97e046..ade9d8810 100644 --- a/src/audio_format.h +++ b/src/audio_format.h @@ -22,9 +22,9 @@ #include "mpd_types.h" typedef struct _AudioFormat { - volatile mpd_sint8 channels; - volatile mpd_uint32 sampleRate; - volatile mpd_sint8 bits; + mpd_sint8 channels; + mpd_uint32 sampleRate; + mpd_sint8 bits; } AudioFormat; static inline double audio_format_time_to_size(const AudioFormat * af) -- cgit v1.2.3