[LAU] Simple, easy multithreaded circular buffer library for Linux?

Olivier Guilyardi ml at xung.org
Sun Oct 19 15:23:44 EDT 2008


Ken Restivo a écrit :
> On Sun, Oct 19, 2008 at 01:03:23PM +0200, Olivier Guilyardi wrote:
>> Ken Restivo a écrit :
>>> On Fri, Oct 17, 2008 at 04:39:25PM +0200, Olivier Guilyardi wrote:
>>>> svn co http://svn.samalyse.com/misc/rbtest
>>>> cd rbtest
>>>> make test
>>>>
>>> cc -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:113: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long unsigned int’
>>> cc -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:113: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long unsigned int’
>>> cc -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:113: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long unsigned int’
>>> cc -Wall -I. -I./jack -lpthread -o test-int-array-jack-fix1 \
>>> 		test-int-array.c jack/ringbuffer-fix1.c
>>> test-int-array.c: In function ‘main’:
>>> test-int-array.c:113: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long unsigned int’
>> I only got these warnings on Mac OS X, I suppose it depends on the gcc 
>> and/or libc version. That did not cause any segfault in my case though. 
>> I've fixed it anyway.
>>
>>> ./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
>>> ./alltests.sh: line 9:  7742 Segmentation fault      ./test-int-array-jack $BUFFER_SIZE
>>>
>>> Info on the system this was run on, is here:
>>> http://restivo.nfshost.com/projects/asus/system-details/
>> Please update rbtest to r309.
>>
> 
> 
> $ svn update
> U    test-int-array.c
> Updated to revision 309.
> 
> 
> $ make clean
> rm test-int-array-jack test-int-array-portaudio test-int-array-portaudio-nobarrier \
> 		test-int-array-jack-fix1
> 
> 
> $ make test
> cc -Wall -I. -I./jack -lpthread -o test-int-array-jack \
> 		test-int-array.c jack/ringbuffer.c
> cc -Wall -I. -I./portaudio -lpthread -o test-int-array-portaudio \
> 		test-int-array.c portaudio/ringbuffer.c portaudio/pa_ringbuffer.c
> cc -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
> cc -Wall -I. -I./jack -lpthread -o test-int-array-jack-fix1 \
> 		test-int-array.c jack/ringbuffer-fix1.c
> ./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
> ./alltests.sh: line 9: 16706 Segmentation fault      ./test-int-array-jack $BUFFER_SIZE
> 
> === Jack ringbuffer test (with fix 1) ===
> starting ringbuffer stress test (2 minutes max)
> buffer size (bytes): 512
> array size (bytes): 256
> ./alltests.sh: line 13: 16709 Segmentation fault      ./test-int-array-jack-fix1 $BUFFER_SIZE
> 
> === Portaudio ringbuffer test ===
> starting ringbuffer stress test (2 minutes max)
> buffer size (bytes): 512
> array size (bytes): 256
> ./alltests.sh: line 17: 16712 Segmentation fault      ./test-int-array-portaudio $BUFFER_SIZE
> 
> === Portaudio ringbuffer test (without memory barriers) ===
> starting ringbuffer stress test (2 minutes max)
> buffer size (bytes): 512
> array size (bytes): 256
> ./alltests.sh: line 21: 16715 Segmentation fault      ./test-int-array-portaudio-nobarrier $BUFFER_SIZE
> make: *** [test] Error 139
> 
> :-(
> 
> $ dpkg -l libc6 gcc
> ii  gcc                               4:4.1.2-3                       The GNU C compiler
> ii  libc6                             2.7-1                           GNU C Library: Shared libraries
> 
> Unfortunately, I cannot and will not update this machine right now to see if that makes rbtest work, because everything else on this machine works stably, it's my gigging synth as well as my laptop, and I can't afford to have it destablize. Sorry.

That's weird. Please try this:

cc -Wall -g -I. -I./jack -lpthread -o test-int-array-jack test-int-array.c 
jack/ringbuffer.c

gdb --args ./test-int-array-jack 512

And type "run" in gdb

-- 
   Olivier Guilyardi / Samalyse







More information about the Linux-audio-user mailing list