Paul Davis wrote:
The test that Olivier has written is essentially a
no-op on a
uniprocessor x86 system, because there are no cache coherency issues.
The code *is* thread safe on a uniprocessor because of the logic above,
not because we rely on instruction reordering/memory barrier processor
behaviour.
i haven't thought much about this issue, but the fact that i got a
failure on an uniprocessor athlon64 seems to contradict your statement:
(posted to linux-audio-dev earlier:)
nettings@kleineronkel:/build/rbtest> make test
gcc -Wall -I. -I./jack -lpthread -o test-int-array-jack \
test-int-array.c jack/ringbuffer.c
test-int-array.c: In function ‘main’:
test-int-array.c:101: warning: format ‘%d’ expects type ‘int’, but
argument 2 has type ‘long unsigned int’
gcc -Wall -I. -I./portaudio -lpthread -o test-int-array-portaudio \
test-int-array.c portaudio/ringbuffer.c
portaudio/pa_ringbuffer.c
test-int-array.c: In function ‘main’:
test-int-array.c:101: warning: format ‘%d’ expects type ‘int’, but
argument 2 has type ‘long unsigned int’
gcc -Wall -I. -I./portaudio -lpthread -o
test-int-array-portaudio-nobarrier \
-DNO_MEMORY_BARRIER \
test-int-array.c portaudio/ringbuffer.c
portaudio/pa_ringbuffer.c
test-int-array.c: In function ‘main’:
test-int-array.c:101: warning: format ‘%d’ expects type ‘int’, but
argument 2 has type ‘long unsigned int’
./alltests.sh
Starting ringbuffer tests (buffer size: 512)
=== Jack ringbuffer test ===
starting ringbuffer stress test (2 minutes max)
buffer size (bytes): 512
array size (bytes): 256
reader started on cpu 0
writer started on cpu: 0
49536 != 49408 at offset 0
failure in chunk 330502
--
jörn nettingsmeier
home://germany/45128 essen/lortzingstr. 11/
http://spunk.dnsalias.org
phone://+49/201/491621
Kurt is up in Heaven now.