[LAD] Inter thread Communication: Design Approach

Paul Davis paul at linuxaudiosystems.com
Thu Sep 1 20:36:14 UTC 2011


On Thu, Sep 1, 2011 at 4:33 PM, David Robillard <d at drobilla.net> wrote:
> On Thu, 2011-09-01 at 15:54 -0400, Paul Davis wrote:
>> On Thu, Sep 1, 2011 at 2:37 PM, Fons Adriaensen <fons at linuxaudio.org> wrote:
>>
>> > That's assuming that the event's virtual execute() has access to
>> > all it needs. In all cases I've encountered that is not the case:
>> > the event triggers something in the context where it is received
>> > and processing it requires access to that context's data.
>> > It's a problem for which I don't know a clean C++ solution.
>>
>> depending on the exact type of thing you're talking about, isn't this
>> is place for closures, functors, etc. etc. ?
>
> The event pretty much is a glorified closure, but, alas, the multiple
> contexts of execution complicate it so you have to manually store what
> are actually the 'parameters' and such so you can do the work later.
>
> In less primitive languages you might be able to do something nice with
> actual closures and continuations, but... oh well.

the execute member can be a functor rather than a virtual function, for example.



More information about the Linux-audio-dev mailing list