Hi, You might also want to have a look at how Supercollider does it:
http://www.supercolliderbook.net/ Look below for the chapter by Ross Bencina. Cheers, Andrés On Tue, Dec 20, 2011 at 3:49 AM, Paul Davis <[email protected]> wrote: > On Mon, Dec 19, 2011 at 8:10 PM, Iain Duncan <[email protected]> > 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 > [email protected] > http://lists.linuxaudio.org/listinfo/linux-audio-dev _______________________________________________ Linux-audio-dev mailing list [email protected] http://lists.linuxaudio.org/listinfo/linux-audio-dev
