http://www.cs.wustl.edu/~schmidt/PDF/DC-Locking.pdf

 

Greetings, 

Richard 

________________________________

Von: osg-users-boun...@lists.openscenegraph.org 
[mailto:osg-users-boun...@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()

 

Hi Anthony,

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.

Robert. 

On Tue, Mar 17, 2009 at 6:25 AM, I-Nixon, Anthony D 
<anthony.d.ni...@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
been called).

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,
of course.

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.




Anthony Nixon

_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

 

_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to