HI Pjotr,

On 27 October 2014 11:50, Pjotr Svetachov <pjotrsvetac...@gmail.com> wrote:

> You said that you were working with shaders. A race condition that looks
> like the Texture2D::setImage example above can also happen with shaders in
> .osg files:
> The method Shader_readLocalData can get shaders out of a cache when files
> are referenced. Then later in Program::addShader the program will call
> shader->addProgramRef which does not look thread safe to me.
>

I don't use the Registry object cache for the shader terrain code I'm
currently writing so I don't think I'll be hitting this particular issue.

I so agree that the Shader::addProgramRef()/removeProgramRef() isn't thread
safe.  There is a parallel to the Node::addParent/removeParent() method and
these are protected by the mutex lock, so I've added the same lock to the
Shader::addProgramRef()/removeProgramRef(). I will test this out on my
system and check it into svn/trunk is all goes well.  This particular fix
will be safe to check into the OSG-3.2 branch as it won't affect the ABI.

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

Reply via email to