Hi Abhishek,

The thread safety provided by the OSG isn't quite what you are
assuming, just setting the DataVariance to DYNAMIC only affects
whether the update, event and cull traversals of the current frame can
be run multi-thread the draw traversal of the previous frame, and this
hint is only applicable to StateSet and Drawable and is used to
prevent multi-threading where objects are that are being modified by
the update or event traversals running concurrently with the draw
thread that is reading from them.  This threading model is
light-weight in that it avoids the need to large numbers of mutex
locks or multi-buffering, but it doesn't provide an means for general
multi-threading.  The OSG's multi-threading also can handle running
cull or draw threads on multiple contexts in parallel, and with
database paging, again this is done a light-weight manner than scales
well and has a small overhead.  The design is very much geared towards
the needs of high performance graphics applications rather than
general purpose multi-threading.

So... you'll need to take a step back and work on how to work best
with the design of the OSG.  The OSG is designed to allow single
threaded updates of the scene graph during the update and event
traversals.  If you do wish to do some work multi-thread preparing new
scene graph elements these can be done as a separate subgraph in a
separate thread then merged with the main scene graph during the
update phase - this is how the osgDB::DatabasePager works.

Robert.

On 23 February 2013 05:42, Abhishek Bansal <discover...@gmail.com> wrote:
> Hi,
>
> In my scene graph I have  root node and  I am doing deletion/addition of 
> nodes in scenegraph at run time from a different thread than main thread. 
> These nodes are simple textured quads and are having dynamic textures. Data 
> variance of root node as well as these child nodes is set to DYNAMIC.
> My Osg::Viewer threading model is set to SingleThreaded.
>
> What I found from previous posts is that multi-threading should not be the 
> issue as long as we are setting data variance to DYNAMIC.
>
> I was trying to reproduce this crash after setting osg::NotifyLevel to INFO. 
> I will post more details as oon as i get some log.
>
> meanwhile the call stack i am getting is as follows
>
>> msvcp90d.dll!std::_Debug_message(const wchar_t * message=0x57139ee0, const 
>> wchar_t * file=0x5712f870, unsigned int line=251)  Line 24 C++
>   
> osg80-osgd.dll!std::_Vector_const_iterator<osg::ref_ptr<osg::Node>,std::allocator<osg::ref_ptr<osg::Node>
>  > >::_Compat(const 
> std::_Vector_const_iterator<osg::ref_ptr<osg::Node>,std::allocator<osg::ref_ptr<osg::Node>
>  > > & _Right={_ptr=0x00000000 })  Line 251 + 0x17 bytes C++
>   
> osg80-osgd.dll!std::_Vector_const_iterator<osg::ref_ptr<osg::Node>,std::allocator<osg::ref_ptr<osg::Node>
>  > >::operator==(const 
> std::_Vector_const_iterator<osg::ref_ptr<osg::Node>,std::allocator<osg::ref_ptr<osg::Node>
>  > > & _Right={_ptr=0x00000000 })  Line 211 C++
>   
> osg80-osgd.dll!std::_Vector_const_iterator<osg::ref_ptr<osg::Node>,std::allocator<osg::ref_ptr<osg::Node>
>  > >::operator!=(const 
> std::_Vector_const_iterator<osg::ref_ptr<osg::Node>,std::allocator<osg::ref_ptr<osg::Node>
>  > > & _Right={_ptr=0x00000000 })  Line 216 + 0xc bytes C++
>   osg80-osgd.dll!osg::Group::traverse(osg::NodeVisitor & nv={...})  Line 60 + 
> 0x33 bytes C++
>   osg80-osgd.dll!osg::NodeVisitor::traverse(osg::Node & node={...})  Line 193 
> + 0x1c bytes C++
>   
> osg80-osgUtild.dll!osgUtil::CullVisitor::handle_cull_callbacks_and_traverse(osg::Node
>  & node={...})  Line 312 + 0xf bytes C++
>   osg80-osgUtild.dll!osgUtil::CullVisitor::apply(osg::Transform & node={...}) 
>  Line 1151 C++
>   osg80-osgd.dll!osg::NodeVisitor::apply(osg::MatrixTransform & node={...})  
> Line 136 + 0x13 bytes C++
>   osg80-osgd.dll!osg::MatrixTransform::accept(osg::NodeVisitor & nv={...})  
> Line 37 + 0x41 bytes C++
>   osg80-osgd.dll!osg::Group::traverse(osg::NodeVisitor & nv={...})  Line 62 + 
> 0x25 bytes C++
>   osg80-osgd.dll!osg::NodeVisitor::traverse(osg::Node & node={...})  Line 193 
> + 0x1c bytes C++
>   
> osg80-osgUtild.dll!osgUtil::CullVisitor::handle_cull_callbacks_and_traverse(osg::Node
>  & node={...})  Line 312 + 0xf bytes C++
>   osg80-osgUtild.dll!osgUtil::CullVisitor::apply(osg::Transform & node={...}) 
>  Line 1151 C++
>   osg80-osgd.dll!osg::NodeVisitor::apply(osg::MatrixTransform & node={...})  
> Line 136 + 0x13 bytes C++
>   osg80-osgd.dll!osg::MatrixTransform::accept(osg::NodeVisitor & nv={...})  
> Line 37 + 0x41 bytes C++
>   osg80-osgd.dll!osg::Group::traverse(osg::NodeVisitor & nv={...})  Line 62 + 
> 0x25 bytes C++
>   osg80-osgd.dll!osg::NodeVisitor::traverse(osg::Node & node={...})  Line 193 
> + 0x1c bytes C++
>   
> osg80-osgUtild.dll!osgUtil::CullVisitor::handle_cull_callbacks_and_traverse(osg::Node
>  & node={...})  Line 312 + 0xf bytes C++
>   osg80-osgUtild.dll!osgUtil::CullVisitor::apply(osg::Group & node={...})  
> Line 1128 C++
>   osg80-osgd.dll!osg::Group::accept(osg::NodeVisitor & nv={...})  Line 38 + 
> 0x41 bytes C++
>   osg80-osgd.dll!osg::Group::traverse(osg::NodeVisitor & nv={...})  Line 62 + 
> 0x25 bytes C++
>   osg80-osgd.dll!osg::NodeVisitor::traverse(osg::Node & node={...})  Line 193 
> + 0x1c bytes C++
>   osg80-osgUtild.dll!osgUtil::SceneView::cullStage(const osg::Matrixd & 
> projection={...}, const osg::Matrixd & modelview={...}, osgUtil::CullVisitor 
> * cullVisitor=0x04062250, osgUtil::StateGraph * rendergraph=0x04061990, 
> osgUtil::RenderStage * renderStage=0x04061a28, osg::Viewport * 
> viewport=0x04073f08)  Line 980 + 0x1a bytes C++
>   osg80-osgUtild.dll!osgUtil::SceneView::cull()  Line 845 + 0x57 bytes C++
>   osg80-osgViewerd.dll!osgViewer::Renderer::cull_draw()  Line 809 + 0xf bytes 
> C++
>   osg80-osgViewerd.dll!osgViewer::Renderer::operator()(osg::GraphicsContext * 
> context=0x04b018e0)  Line 888 + 0xf bytes C++
>   osg80-osgd.dll!osg::GraphicsContext::runOperations()  Line 756 + 0x33 bytes 
> C++
>   osg80-osgViewerd.dll!osgViewer::ViewerBase::renderingTraversals()  Line 807 
> + 0x15 bytes C++
>   osg80-osgViewerd.dll!osgViewer::ViewerBase::frame(double 
> simulationTime=1.7976931348623157e+308)  Line 645 + 0xf bytes C++
>   VDViewerd.dll!VDViewer::VDViewerWindow::paintEvent(QPaintEvent * 
> event=0x00bdcdac)  Line 204 + 0x35 bytes C++
>
> here VDViewer is viewer class.
>
> ...
>
> Thank you!
>
> Cheers,
> Abhishek
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=52830#52830
>
>
>
>
>
> _______________________________________________
> 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