Re: [LAD] how to store deferred events in a real time audio app?

From: Paul Davis <paul@email-addr-hidden>
Date: Tue Dec 20 2011 - 05:49:22 EET

On Mon, Dec 19, 2011 at 8:10 PM, Iain Duncan <iainduncanlists@email-addr-hidden> wrote:

> However, I would like to add the ability for the user to send a message and
> have it get executed later, where later gets figured out by the engine ( ie
> on the top of the next 8 bar phrase ). To do this, I need some way of
> storing deferred events and having the engine check on each step whether
> there were any deferred events stored for 'now'. I can think of a few ways
> to do this, and all of them raise red flags for a real time thread.

1) don't allow out-of-order queuing
2) just use a FIFO (i.e. ye olde single-reader/single-writer lock free
ringbuffer) to enqueue events between the engine and another thread
(presumably a GUI)

things get more complex if you insist on allowing out-of-order queuing
and/or more than one thread is delivering events. but not a lot more.
you can so multi-writer/single-reader FIFO in an RT safe way by
requiring a lock to write, but none to read, which serializes writes
and reduces it to an effectively single-writer/single reader
situation.
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/listinfo/linux-audio-dev
Received on Tue Dec 20 08:15:01 2011

This archive was generated by hypermail 2.1.8 : Tue Dec 20 2011 - 08:15:02 EET