Hi Robert, I was also thinking that using a custom DeleteHandler would be sufficient to constrain deletions to the render thread. However, I'd like to avoid that if possible because it would require periodic purging of pending deletions and I believe that would make it difficult to use the stock osgViewer components in the same way as in C++.
It's possible to do explicit synchronous deletions via C#, so if there is a small number of classes/situations that require deletion via the render thread I think it would be better and cleaner to have the user take on this responsibility. Given what you wrote below would it be correct to say that, under normal osgViewer usage, ensuring the viewer object is deleted in the render thread is sufficient to ensure all the OpenGL objects are deleted in the render thread? -Mike > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:osg-users- > [EMAIL PROTECTED] On Behalf Of Robert Osfield > Sent: Wednesday, April 11, 2007 2:39 AM > To: osg users > Subject: Re: [osg-users] Threading and object deletion > > Hi Mike, > > The only objects that you need to delete from a specific place are the > OpenGL objects, and these are cached and then flushed at the > appropriate point by an explicit call to the flush* static functions > (or just SceneView::flushAllDeletedGLObjects()). > > The rest of OSG objects are almost all managed through > osg::Referenced, and it allows you to use a custom osg::DeleteHandler > to capture and manage the final delete operations. osgViewer::Viewer > now uses a DeleteHandler to control when actual deletes happen, to > prevent the DrawThreadPerContext, > CullThreadPerCameraDrawThreadPerContext threading modes for having > problems with dangling pointers. > > My guess is that you might be able to use a custom DeleteHandler to > tightly control deletion of scene graph objects. > > Robert. > > On 4/10/07, Mike Wittman <[EMAIL PROTECTED]> wrote: > > > > > > > > > > Hi Robert, > > > > > > > > Can you provide guidance on which OSG class objects need to be deleted > from > > the render thread, vs. which can be deleted from any thread? In C# the > > garbage collector can run on an arbitrary thread, so I need to ensure it > > isn't deleting anybody incorrectly. > > > > > > > > > > Mike Wittman > > > > [EMAIL PROTECTED] > > > > ___________________________________________________ > > > > Seismic Micro-Technology, Inc. > > > > 8584 Katy Freeway, Suite 400 / Houston, Texas 77024 > > > > Tel. +1 (713) 464-6188 > > > > Fax. +1 (713) 464-6440 > > > > Web: www.seismicmicro.com > > > > ___________________________________________________ > > > > Seismic through Simulation with KINGDOM, (RC)2, and SURE! - CONTACT US > TODAY > > for more information. > > > > > > > > > > _______________________________________________ > > osg-users mailing list > > osg-users@openscenegraph.net > > http://openscenegraph.net/mailman/listinfo/osg-users > > http://www.openscenegraph.org/ > > > _______________________________________________ > osg-users mailing list > osg-users@openscenegraph.net > http://openscenegraph.net/mailman/listinfo/osg-users > http://www.openscenegraph.org/ _______________________________________________ osg-users mailing list osg-users@openscenegraph.net http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/