Hi Richard,

This morning I awoke with the thought that the new atomic ref counting
code most likely has broken the thread safe
addParent()/removeParent().   To fix this we'll need to reintroduce
another mutex for this task, either one per Object/Referenced or
perhaps a shared one.  Mutex's are quite costly
memory/allocation/deletion wise so it might be good to share a single
one.

Robert.

On Tue, Oct 14, 2008 at 8:14 AM, Schmidt, Richard
<[EMAIL PROTECTED]> wrote:
> Hi Robert,
> I am using osg 2.6.0 and you're right, osg::Node as well as
> osg::Stateset use getRefMutex for protecting the access to the parent
> list. However getRefMutex isn't used in the atomic refcounted case and
> osg::StateAttribute doesn't use a mutex at all for protecting the
> parents.
>
> The method (Node|Stateset|StateAttribute) ::getParent, ::getParents,
> ::getNumParents doesn't seem to be protected by a mutex as well. I
> wonder if that's intented.
>
> Richard
>
>
>>HI Richard,
>>
>>Which version of the OSG are you using?  The OSG has had mutex
>>protection of addParents/removeParent() for quite some while.
>>
>>Robert.
>
> On Mon, Oct 13, 2008 at 7:59 AM, Schmidt, Richard
> <[EMAIL PROTECTED]> wrote:
>> Osg has the option to cache nodes by using osgDB:Registry. Retrieving
> a node
>> from the cache and attaching them to your subgraph is not threadsafe,
>> because Node::addParent, Node::removeParent and Node::getParents is
> not
>> threadsafe.
>>
>>
>>
>> Consider this scenario: A node gets 'disposed' in the main thread,
> because
>> the 'user' deatches the node from the graph. At the same time the node
> may
>> be loaded from the cache by the databasepager. While the refcounting
> will
>> work perfectly, the calls to Node::addParent and Node::removeParent is
> not
>> threadsafe, causing the node to get an invalid parent setup.
>>
>>
>>
>> The same holds for StateSet and StateAttribute (because they have
>> parentlinks as well). Example: The openflight loader stores static ref
>> pointers to various StateAttributes. The StateAttribute::addParent and
>> StateAttribute::removeParent may be called from multiple threads, i.e
> the
>> main thread releases a model, while another thread (the databasepager)
> loads
>> the model.
>>
>>
>>
>> Possible solution: Make the parent links threadsafe. For Statesets and
>> StateAttributes I would remove them and implementing an "immutable"
> pattern
>> instead.
>>
>>
>>
>> Richard
>>
>>
>>
>> Richard Schmidt
>>
>> System Designer
>>
>> EADS Deutschland GmbH
>>
>> Organisationseinheit (SDGE1)
>>
>>
>>
>> EADS Deutschland GmbH
>>
>> Registered Office: Ottobrunn
>>
>> District Court of Munich HRB107648
>>
>> Chairman of the Supervisory Board: Dr. Thomas Enders Managing
> Directors: Dr.
>> Stefan Zoller (chairman), Michael Hecht
>>
>> This E-mail And any attachment(s) to it are for the addressee's use
> only. It
>> is strictly confidential and may contain legally privileged
> information. No
>> confidentiality Or privilege is waived or lost by any mistransmission.
> If
>> you are not the intended addressee, then please delete it from your
> system
>> and notify the sender immediately. You are hereby notified that any
> use,
>> disclosure, copying or any action taken in reliance on it is strictly
>> prohibited and may be unlawful. - Thank you.
>>
>>
>>
>> _______________________________________________
>> osg-users mailing list
>> [email protected]
>>
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
> g
>>
>>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
> g
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to