Krzysztof Foltman wrote:
> What version did you test it with? The #37 fix has been applied _after_
> beta3 has been released. So, in theory, the bug shouldn't happen with
> trunk anyway, at least if my fix is correct (the trunk contains only one

It happened with trunk.

> If it still happens *with trunk*, then just adding a mutex might improve
> the thread safety while worsening realtime safety, by causing priority
> inversion once in a while (low-priority GUI thread may block the audio
> thread for too long).

While true... it should only be an issue during start-up -- a time when we 
shouldn't be in any real-time threads, anyway.

Thanks for pointing out the workaround for the mutex.

>> While the Hydrogen() constructor is executing... someone else calls 
>> get_instance() and, finding a NULL __instance, double-calls the constructor. 
> 
> That "someone else" is the MIDI thread code. Again, see #37 and related
> discussion, it has almost too much of a detailed explanation.

Yes, it is the MIDI thread -- but it *could be* anyone.

I'll go do my required reading.  :-)  Sorry that I didn't do it before.

I considered that we might try to do it something like this (similar to how the 
Qt library does it):

// Remove the Hydrogen::__instance class member and do:
Hydrogen& get_hydrogen_instance(void)
{
        static Hydrogen h;
        return h;
}

-- or like this --

// Remove the Hydrogen::__instance class member and do:
Hydrogen* get_hydrogen_instance(void)
{
        static Hydrogen h;
        return &h;
}

I'll look in to it more at lunch.

Peace,
Gabriel


------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Hydrogen-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hydrogen-devel

Reply via email to