[LAD] Inter thread Communication: Design Approach
Harry van Haaren
harryhaaren at gmail.com
Sat Aug 20 14:19:17 UTC 2011
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.
Gui needs to feed data trough to the jack thread (data = parameter moves
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
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
I'm very intrested how the "big" programs around have approached this
problem... Cheers, -Harry
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Linux-audio-dev