Re: [LAD] Inter thread Communication: Design Approach

From: Florian Paul Schmidt <mista.tapas@email-addr-hidden>
Date: Fri Sep 02 2011 - 20:29:16 EEST

On 09/02/2011 05:13 PM, David Robillard wrote:
> On Fri, 2011-09-02 at 10:36 +0200, Florian Paul Schmidt wrote:
>> On 09/01/2011 10:37 PM, Harry van Haaren wrote:
> [...]
>> 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.
> Careful doing this, note that dropping the last shared_ptr to an object
> is NOT real-time (it calls delete), even if destroying the actual object
> is.
>

yeah. that's why there's a extra reference stored in a list whenever an
(disposable) object is created.. This list is traversed periodically
from within the GUI thread to check whether any one's object refcount
has dropped to 1 (not 0) and only then is that last reference removed
from the list causing the ref count to go to 0 and the object finally
being deleted (in the GUI thread)..

Note that all objects the engine manages in jass are stored in
disposable<T> which forces them to be allocated through the factory
function that always stores an extra reference in the list..

Regards,
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 20:15:03 2011

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