Hi Rico,

On 28 November 2014 at 09:11, Rico Widmer <[email protected]> wrote:

> 1) My program uses multiple threads which access the same node object
> returned by osgDB::readNodeFile(). Is the access to this object thread
> safe? My program doesn't change the object directly but I don't know if OSG
> changes the object or a cache or something similar. If so, it might be
> necessary to lock the access to this object.
>

Whether it's safe depends upon the timing of when all these threads and
what other threads might be done.  If the scene graph isn't be modified by
any threads in the application (yours or ones created by the OSG) then
there shouldn't be any issue.  I don't know enough about the timing of your
threads or what you have setup the rest of the OSG to do to know whether
your particular usage is thread safe.


> 2) Multiple threads will call osgDB::readNodeFile() simultaneously. Is
> there a need to lock threads away when a thread is using this method? In
> the OSG code I saw that the caching mechanism is thread safe. I couldn't
> really figure out though if this is enough to let every thread use that
> function at-will.
>

There are mechanisms within osgDB::Regisitry and the plugins to allow them
to be used in a thead safe way.  I would say though you are best to use
OSG-3.2.1 rather than 3.0.x as there have been various improvements and
thread bug fixes in 3.2.1.  There have been further fixes since 3.2.1 as
well so the svn/trunk and OSG-3.2 branch will be the most reliable w.r.t
really hammering the threading side.

Robert.
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to