Re: [LAD] Atomic Operations

From: Tim Blechmann <tim@email-addr-hidden>
Date: Thu Dec 17 2009 - 14:03:48 EET

> +#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@email-addr-hidden
http://tim.klingt.org
/"\  ASCII Ribbon Campaign
\ /   no HTML in email & vCards
 X     no proprietary attachments
/ \     use open standards

_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-dev

Received on Thu Dec 17 16:15:04 2009

This archive was generated by hypermail 2.1.8 : Thu Dec 17 2009 - 16:15:04 EET