Re: [LAD] Inter thread Communication: Design Approach

From: Paul Davis <paul@email-addr-hidden>
Date: Sun Sep 04 2011 - 03:42:29 EEST

On Sat, Sep 3, 2011 at 5:25 PM, Fons Adriaensen <fons@email-addr-hidden> wrote:
> On Fri, Sep 02, 2011 at 07:50:17AM -0400, Paul Davis wrote:
>
>> i'm pretty confused by what you've written here. i use functors which
>> have copy semantics, and the "event" classes that contain a functor do
>> not contain a pointer to a functor, but a functor that is copied. this
>> is the base class:
>>
>>       struct BaseRequestObject {
>>           RequestType             type;
>>             bool                    valid;
>>             InvalidationRecord*     invalidation;
>>           boost::function<void()> the_slot;
>>
>>             BaseRequestObject() : valid (true), invalidation (0) {}
>>       };
>>
>> the "type" member is still there, but differentiates between requests
>> that require use of the functor ("the_slot") and those that are just
>> an enum that can be handled with no data (e.g. telling an event
>> loop/thread to quit).
>
> Mmm. Did you ever look at what's going on behind the scenes
> (/usr/include/boost/function/function/function_base.hpp) ?
>
> Calling a void function(void) is a basic language operation,
> supported directly by most CPU instruction sets and normally
> translating into just a few CPU instrunctions. If doing this
> requires > 900 lines of code (plus all the files included from
> the one referred to) I'd say there is something fundamentally
> wrong. Even emulating a function call on a different CPU or
> a virtual one doesn't take anything like that.

this is a complete diversion from the point i was making.

if the functor has copy semantics, its not true that you must have a
pointer to the functor in an event/request structure.

the issues with the performance of boost::function are reasonably well
known and were well documented in the article that florian linked to,
along with a much better performing drop-in replacement.
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/listinfo/linux-audio-dev
Received on Sun Sep 4 04:15:02 2011

This archive was generated by hypermail 2.1.8 : Sun Sep 04 2011 - 04:15:02 EEST