Falk Hueffner wrote:
Hi,

the correct solution is to use __sync_synchronize as fallback, which
is a full memory barrier defined by gcc (starting from 4.1) for all
platforms. It is also desirable to use this on all platforms that
don't differentiate read/write/full barriers, since it gives the
compiler better opportunities to optimize.


Do you have a patch? I tried to use __sync_synchronize on i386, but it doesn't generate any synchronization code in the assembler output.

Mikael

--- old-working/src/common/pa_ringbuffer.c 2007-01-29 11:27:55.000000000 +0100 +++ new-working/src/common/pa_ringbuffer.c 2007-01-29 11:27:55.000000000 +0100
@@ -86,9 +86,9 @@
 #      define PaUtil_ReadMemoryBarrier()  asm volatile("sync":::"memory")
 #      define PaUtil_WriteMemoryBarrier() asm volatile("sync":::"memory")
# elif defined( __i386__ ) || defined( __i486__ ) || defined( __i586__ ) || defined( __i686__ )
-#      define PaUtil_FullMemoryBarrier()  asm volatile("mfence":::"memory")
-#      define PaUtil_ReadMemoryBarrier()  asm volatile("lfence":::"memory")
-#      define PaUtil_WriteMemoryBarrier() asm volatile("sfence":::"memory")
+#      define PaUtil_FullMemoryBarrier()  __sync_synchronize
+#      define PaUtil_ReadMemoryBarrier()  __sync_synchronize
+#      define PaUtil_WriteMemoryBarrier() __sync_synchronize
 #   else
 #      ifdef ALLOW_SMP_DANGERS
# warning Memory barriers not defined on this system or system unknown



--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to