Re: [LAD] memory allocation for the real time thread, opinions wanted

From: David Robillard <d@email-addr-hidden>
Date: Wed Feb 29 2012 - 22:12:31 EET

On Tue, 2012-02-28 at 16:34 -0500, Paul Coccoli wrote:
> On Mon, Feb 27, 2012 at 8:43 PM, James Morris <james@email-addr-hidden-art.net> wrote:
> > On Mon, 27 Feb 2012 20:01:18 -0500
> > Paul Coccoli <pcoccoli@email-addr-hidden> wrote:
> [Mass snippage]
> >> Why not just use 2 ringbuffers: one to send pointers to the RT thread,
> >> and a second to send them back to the low prio thread (so it can free
> >> them). You probably need a semaphore for the return ringbuffer, but
> >> that should be RT-safe.
> >
> > That's what I thought... would be better for someone who is new to real
> > time threads and memory allocation... and is what I decided on... minus
> > the semaphore.
> >
> > So why is a semaphore needed? If the RT thread only sends an item back
> > when it absolutely no longer will use it?
>
> I suppose the semaphore isn't strictly necessary, but I think it's an
> easy way to tell the main thread that it has a message to process.
> Although one that probably doesn't integrate well with most
> main/non-RT threads.

For a main thread that's always rolling anyway you wouldn't use one.
The semaphore is to wake up a receiving thread that is *waiting* for a
message from the ringbuffer (e.g. it is a worker thread solely dedicated
to that)

-dr

_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/listinfo/linux-audio-dev
Received on Thu Mar 1 00:15:01 2012

This archive was generated by hypermail 2.1.8 : Thu Mar 01 2012 - 00:15:01 EET