[LAD] Atomic Operations

Tim Blechmann tim at klingt.org
Thu Dec 17 12:03:48 UTC 2009


> +#if defined(__APPLE__)
> +#include <libkern/OSAtomic.h>
> +#define MEMORY_BARRIER() OSMemoryBarrier()
> +#elif (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)
> +#define MEMORY_BARRIER() __sync_synchronize()
> +#else
> +#warning SMP Danger: memory barriers are not supported on this system
> +#endif

there was a buggy gcc version, that didn't implement
__sync_synchronize() correctly on x86, causing errors on nehalem
machines (which don't have a shared cache).

if sse is enabled, _mm_mfence() can be used to work around this compiler
bug ...

tim

-- 
tim at klingt.org
http://tim.klingt.org

/"\  ASCII Ribbon Campaign
\ /   no HTML in email & vCards
 X     no proprietary attachments
/ \     use open standards

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: OpenPGP digital signature
URL: <http://lists.linuxaudio.org/pipermail/linux-audio-dev/attachments/20091217/bcd181f2/attachment.pgp>


More information about the Linux-audio-dev mailing list