Hi folks,

should the IntersectionVisitor and LineSegmentIntersector be threadsafe?

With the multithreaded pseudocode below everything works fine with the 
ScopedLock. If I disable the ScopedLock I get wrong results.

Thank you!

Cheers,
Matthias


Code:

osg::Vec3d dummy;
osg::ref_ptr<osgUtil::LineSegmentIntersector> lineSegmentIntersector = new 
osgUtil::LineSegmentIntersector(dummy, dummy);
osg::ref_ptr<osgUtil::IntersectionVisitor> visitor = new 
osgUtil::IntersectionVisitor(lineSegmentIntersector);

...
osg::Vec3d P1, P2;

lineSegmentIntersector->setStart(P1);
lineSegmentIntersector->setEnd(P2);

...
osg::Node* searchroot;
OpenThreads::Mutex mutex;

...
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex); // Works when enabled. 
Doesn't work when disabled!
lineSegmentIntersector->reset();
searchroot->accept(*visitor);
}

if (lineSegmentIntersector->containsIntersections())
{
...





------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=64590#64590





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

Reply via email to