Re: [LAD] Inter thread Communication: Design Approach

From: Florian Paul Schmidt <mista.tapas@email-addr-hidden>
Date: Fri Sep 02 2011 - 13:56:14 EEST

On 09/02/2011 12:54 PM, Pedro Alves wrote:
> boost::function<void(void)> serves this purpose for me in jass. To
>> create and pass a functor that assigns a new auditor generator to the
>> one in the engine, and then tells it to play i do for example:
>>
>> write_blocking_command(assign(engine_.auditor_gen, p));
>> write_blocking_command(boost::bind(&engine::play_auditor,
>> boost::ref(engine_))); assign() is just a utility template to make
>> creating functors that do assignments easier.. boost::bind is used to
>> make all passed functors 0-ary (e.g for binding member functions to
>> their instance or binding arguments to the functor.. and
>> write_blocking_command is just a utility function that disables the GUI
>> until the acknowledgement from the engine has come back to the GUI,, The
>> command ringbuffer is just a ringbuffer holding
>> boost::fucntion<void(void)> objects..
>>
>> typedef ringbuffer<boost::function<void(void)> > command_ringbuffer;
>>
>> Examples from here:
>> https://github.com/fps/jass/blob/master/main_window.h
>> https://github.com/fps/jass/blob/master/assign.h
>> https://github.com/fps/jass/blob/master/engine.h Regards, Flo
> There are alternatives (even predecessors) to boost.function that
> are much faster and avoid the heap/new. See
> <http://www.codeproject.com/KB/cpp/fastdelegate2.aspx> for example.
> (I used Don's original "Fastest Possible C++ Delegates" on an embedded
> project years ago -- worked great).
>

Oh, thanks for the interesting read :D

Flo

_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/listinfo/linux-audio-dev
Received on Fri Sep 2 16:15:02 2011

This archive was generated by hypermail 2.1.8 : Fri Sep 02 2011 - 16:15:02 EEST