[osg-users] Multithreading crash due toosgDb::Registry::instance()
Richard.Schmidt at eads.com
Tue Mar 17 02:45:17 PDT 2009
Von: osg-users-bounces at lists.openscenegraph.org [mailto:osg-users-bounces at lists.openscenegraph.org] Im Auftrag von Robert Osfield
Gesendet: Dienstag, 17. März 2009 10:07
An: OpenSceneGraph Users
Betreff: Re: [osg-users] Multithreading crash due toosgDb::Registry::instance()
I have avoided adding a mutex into the Registry::instance() method as it would incur a cost for every call to it, and it's only the very first call that it's an issue for so it's the only time you need to be careful about access to it.
Given I don't want to introduce a mutex one then has to make sure the instance() method is called up front in your app, and most OSG applications will call it during the single thread init of the app, and in your case you'll just need to call it explictly. An alternative might be to have a proxy class call the instance() method, or perhaps just have the viewer constructor call instance() just in case.
On Tue, Mar 17, 2009 at 6:25 AM, I-Nixon, Anthony D <anthony.d.nixon at boeing.com> wrote:
I've encountered a crash when using CompositeViewer in Multithreaded
mode due to concurrent access to osgDb::Registry::instance().
The usage scenario is having two views (that have an empty scene graph -
since no data has been loaded, osgdb::Registry::instance() hasn't yet
On the first frame, each of the render threads calls
osgDb::Registry::instance(), and one gets back a null pointer (which is
kind of bad for an instance :-)
The fix for me is easy - just call osgDb::Registry::instance() sometime
before starting rendering, but a more general solution would be better,
This is with OSG 2.8.0 - although there don't appear to have been any
changes in this area in the trunk, either.
I've only confirmed this on Windows XP and Visual C++ 8.
osg-users mailing list
osg-users at lists.openscenegraph.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the osg-users