Re: [LAD] Inter thread Communication: Design Approach

From: Fons Adriaensen <fons@email-addr-hidden>
Date: Sun Sep 04 2011 - 00:25:22 EEST

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.

Ciao,

-- 
FA
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/listinfo/linux-audio-dev
Received on Sun Sep 4 00:15:02 2011

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