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

Ken Restivo ken at restivo.org
Mon Oct 20 14:47:38 EDT 2008


On Mon, Oct 20, 2008 at 04:02:49PM +0200, Olivier Guilyardi wrote:
> Ken Restivo wrote:
> 
> > Program received signal SIGSEGV, Segmentation fault.
> > [Switching to Thread 1082132816 (LWP 17164)]
> > 0xffffffffff600808 in ?? ()
> > 
> > (gdb) bt
> > #0  0xffffffffff600808 in ?? ()
> > #1  0x00002b53c56aa7f0 in sched_getcpu () from /lib/libc.so.6
> > #2  0x0000000000400941 in reader_start (arg=0x0) at test-int-array.c:50
> > #3  0x00002b53c53cd3f7 in start_thread () from /lib/libpthread.so.0
> > #4  0x00002b53c56b993d in clone () from /lib/libc.so.6
> > 
> > (gdb) f 1
> > #1  0x00002b53c56aa7f0 in sched_getcpu () from /lib/libc.so.6
> > 
> > (gdb) f 2
> > #2  0x0000000000400941 in reader_start (arg=0x0) at test-int-array.c:50
> > 50	  printf("reader started on cpu %d\n", sched_getcpu());
> > 
> > 
> > (gdb) i thr
> >   4 Thread 1090525520 (LWP 17165)  0x00002b53c56b9901 in clone () from /lib/libc.so.6
> >   3 Thread 47638797092576 (LWP 17156)  0x00002b53c56b9901 in clone () from /lib/libc.so.6
> > * 2 Thread 1082132816 (LWP 17164)  0xffffffffff600808 in ?? ()
> >   1 LWP 17156  0x00002b53c56b9901 in clone () from /lib/libc.so.6
> 
> Okay, sched_getcpu() is causing a lot of trouble (not always available,
> segfault'ing, ...). It's gone.
> 
> Please update to r310.


Ah, indeed, now we are getting somewhere:

$ svn update
make    test-int-array.c
U    portaudio/pa_ringbuffer.c
A    fons_lfq
eA    fons_lfq/ringbuffer.h
; maA    fons_lfq/ringbuffer.cpp
A    test-bit-circle.c
U    Makefile
A    run-tests.sh
D    alltests.sh
Updated to revision 314.

$ make; make test
cc -Wall -I. -lpthread -I./jack -o test-int-array-jack \
		test-int-array.c jack/ringbuffer.c
cc -Wall -I. -lpthread -I./portaudio -o test-int-array-portaudio \
		test-int-array.c portaudio/ringbuffer.c portaudio/pa_ringbuffer.c
cc -Wall -I. -lpthread -I./portaudio -o test-int-array-portaudio-nobarrier \
		-DNO_MEMORY_BARRIER \
		test-int-array.c portaudio/ringbuffer.c portaudio/pa_ringbuffer.c
portaudio/pa_ringbuffer.c:127:2: warning: #warning Memory barriers deactivated as requested
cc -Wall -I. -lpthread -I./jack -o test-int-array-jack-fix1 \
		test-int-array.c jack/ringbuffer-fix1.c
c++ -Wall -I. -lpthread -I./fons_lfq -o test-int-array-lfq \
		test-int-array.c fons_lfq/ringbuffer.cpp
cc -Wall -I. -lpthread -I./jack -o test-bit-circle-jack \
		test-bit-circle.c jack/ringbuffer.c
cc -Wall -I. -lpthread -I./portaudio -o test-bit-circle-portaudio \
		test-bit-circle.c portaudio/ringbuffer.c portaudio/pa_ringbuffer.c
cc -Wall -I. -lpthread -I./portaudio -o test-bit-circle-portaudio-nobarrier \
		-DNO_MEMORY_BARRIER \
		test-bit-circle.c portaudio/ringbuffer.c portaudio/pa_ringbuffer.c
portaudio/pa_ringbuffer.c:127:2: warning: #warning Memory barriers deactivated as requested
cc -Wall -I. -lpthread -I./jack -o test-bit-circle-jack-fix1 \
		test-bit-circle.c jack/ringbuffer-fix1.c
c++ -Wall -I. -lpthread -I./fons_lfq -o test-bit-circle-lfq \
		test-bit-circle.c fons_lfq/ringbuffer.cpp
./run-tests.sh bit-circle 512 jack jack-fix1 portaudio portaudio-nobarrier lfq

test-bit-circle-jack - starting (5s max) - buffer size: 512
||- FAILURE: 2 != 514 

test-bit-circle-jack-fix1 - starting (5s max) - buffer size: 512
||- FAILURE: 2 != 514 

test-bit-circle-portaudio - starting (5s max) - buffer size: 512
||||||||||||||||---------- SUCCESS

test-bit-circle-portaudio-nobarrier - starting (5s max) - buffer size: 512
||||-|||||-|||||||----- SUCCESS

test-bit-circle-lfq - starting (5s max) - buffer size: 512
||||||||||||||||------------- SUCCESS

./run-tests.sh int-array 16 jack jack-fix1 portaudio portaudio-nobarrier lfq

test-int-array-jack - starting (20s max) - array/buffer size: 8/16
[reader started] [writer started] [flowing] 49104 != 49100 at offset 0
FAILURE in chunk 24552

test-int-array-jack-fix1 - starting (20s max) - array/buffer size: 8/16
[reader started] [writer started] [flowing] 
SUCCESS

test-int-array-portaudio - starting (20s max) - array/buffer size: 8/16
[reader started] [writer started] [flowing] 


SUCCESS

test-int-array-portaudio-nobarrier - starting (20s max) - array/buffer size: 8/16
[reader started] [writer started] [flowing] SUCCESS

test-int-array-lfq - starting (20s max) - array/buffer size: 8/16
[reader started] [writer started] [flowing] SUCCESS


-ken



More information about the Linux-audio-user mailing list