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.org
>
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to