Re: [LAD] jack ringbuffer question

From: Paul Coccoli <pcoccoli@email-addr-hidden>
Date: Thu Dec 03 2009 - 16:39:54 EET

On Thu, Dec 3, 2009 at 8:14 AM, lieven moors <lievenmoors@email-addr-hidden> wrote:
> Thanks very much for your reply!
> I was reluctant to start using atomic pointers,
> because I might change the program later to
> read longer sequences of Arps. So the ringbuffer approach
> might be a good choice after all.
> I think your idea is exactly what I was looking for.

I was going to suggest the same exact thing as Sean. With the 2
ringbuffers, you're guaranteed that your RT thread is no longer
looking at the old Arp object. You're basically implementing message
passing, while still taking advantage of the threads' shared memory
(where the Arp object resides).

With an atomic pointer swap, I don't think you're guaranteed that.
Each access to the address of the old Arp object would be atomic, but
isn't it still possible that the RT thread reads the old pointer
value, is pre-empted, the other thread swaps the pointers, then the RT
threads tries to access memory a few bytes from the old pointer it
read?
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-dev
Received on Thu Dec 3 20:15:01 2009

This archive was generated by hypermail 2.1.8 : Thu Dec 03 2009 - 20:15:01 EET