[LAD] Inter thread Communication: Design Approach
Florian Paul Schmidt
mista.tapas at gmx.net
Fri Sep 2 08:36:15 UTC 2011
On 09/01/2011 10:37 PM, Harry van Haaren wrote:
> Functors & closures, yeah I suppose... for now this system is working,
> and quite easy to add new types to (does need a big recompile after a
> change though.. as heaps of headers include the "Event" type, as its
> pretty much to core of the Engine.. :)
Hmm, i used Functors and Closures in jass for passing commands to the
realtime thread and wrote a small article about it.
Coupled with a poor man's garbage collection scheme using
boost::shared_ptr's this was a quite quick way to hack up jass. There's
no need to introduce new types if you want to do something new. Actually
there's only exactly one type that gets passed through the command
ringbuffer and that is boost::function<void(void)>. See e.g.
I agree that this method doesn't necessarily scale to other kind of
applications and it also might be a bit more error prone than a well
thought out event system using types that cover all bases, it does make
for a quite good solution for an app of the scope of jass..
> PS: Nice article on "Duct tape programming":
> http://www.joelonsoftware.com/items/2009/09/23.html Especially read
> the paragraph beside the photo of the guy jumping
Taking a look..
More information about the Linux-audio-dev