[LAD] Inter thread Communication: Design Approach

From: Harry van Haaren <harryhaaren@email-addr-hidden>
Date: Sat Aug 20 2011 - 17:19:17 EEST

Hey All,

I'm looking to improve a program's design with regards to how it
communicates between the "jack" thread and its "main/gui" thread. Please
note I'm *not* looking for implementation details like what ringbuffer to
use, this has been discussed here before.

Conditions:
Gui needs to feed data trough to the jack thread (data = parameter moves
etc)
Jack thread needs to push data (buffers for waveforms & "playhead" info)

The real question:
What is a neat solution to passing various data trough a ringbuffer?

My (hacky?) solution: Create a class, call it "Event". Runtime now looks
like so:
1. Create a EventType enum, set the details
2. Write those "Events" into the ringbuffer
3. Switch based on EventType, and handle the event.

While not terribly ugly, that Event class starts to get bigger & nastier, so
I concidered sub-classing it... but I'm not sure this is going in the right
direction.

I'm very intrested how the "big" programs around have approached this
problem... Cheers, -Harry

_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/listinfo/linux-audio-dev
Received on Sun Aug 21 16:15:03 2011

This archive was generated by hypermail 2.1.8 : Sun Aug 21 2011 - 16:15:03 EEST