Hi Julian, I'm afraid this doesn't change the thread safety issue. Having a child being sorted in it's parent container by a value in that child is only really safe if that value is invariant. As soon as break this then not only does the local operations to the child state need to be done in a thread safe way but you also pull the parent into the mix so not changes are now required to the parent which widens out the scope of data changes need to be thread safe.
I have spent way too many hours debugging threading issues like this to be happy to be deliberately adding new gotcha's to the mix. Robert. On 24 June 2016 at 10:33, Julien Valentin <[email protected]> wrote: > Hi Robert > You've already make objection about propertization of Index in > BufferIndexBinding ( unconst _index and add a setter): You objected that my > setIndex was not thread safe > > I would like your opinion about this body func: > > > Code: > > void BufferIndexBinding::setIndex(GLuint index){ > > StateSet**parents=new StateSet* [getNumParents()]; > StateAttribute::GLModeValue *parentmodes =new StateAttribute::GLModeValue > [getNumParents()]; > unsigned int numparent=getNumParents(); > for(unsigned int i=0;i<numparent;i++) > { > parents[i]=getParent(i); > > parentmodes[i]=parents[i]->getAttributeList().find(getTypeMemberPair())->second.second; > } > > ref_ptr<StateAttribute> dummy=this; > > for(unsigned int i=0;i<numparent;i++)parents[i]->removeAttribute(this); > > _index=index; > > for(unsigned int i=0;i<numparent;i++) > parents[i]->setAttributeAndModes(this, parentmodes[i]); > > delete [] parents; > delete [] parentmodes; > > } > > > > Is it still unsafe? > > > Thank you! > > Cheers, > Julien > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=67774#67774 > > > > > > _______________________________________________ > osg-submissions mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org _______________________________________________ osg-submissions mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
