OpenSceneGraph/src/osgPlugins/Inventor
Robert Osfield c399db82a3 From Christopher Baker, submitted by Alberto Luacas, "there is a bug report in the Ubuntu tracker that points to a bug when
loading multiple VRML files in parallel.  Christopher R. Baker has
detected this bug and crafted a patch.  In addition, libcoin has to be
also built with the "--enable-threadsafe" option.

I copy here his report, extracted from
(https://bugs.launchpad.net/ubuntu/+source/openscenegraph/+bug/1211993)
and attach his fix.  All credit is due to him:

«
There are three instances of a classical method-local-static
multithreaded initialization bug in the Inventor plugin for OSG that
trigger various memory faults when reading multiple VRML files in
parallel via osgDB::readNodeFile. These bugs are of the form:

static std::map<Stuff,OtherStuff> myHandyMap;
static bool once = true;
if(once) { ...fill myHandyMap; once = false }
... use myHandyMap;

To repeat: try loading multiple VRML files from multiple threads. The
liklihood of the bug depends on many factors, but my application, which
parallel-loads some dozens of small (<100K) VRML files on startup,
triggers this problem 25% of the time or more.

The attached patch (inventor-plugin-multithread.patch) rectifies this
problem by:

1 - Inheriting MyHandyMap from std::map, then
2 - Moving the map initialization into the derived constructor, which
3 - Is intrinsically protected from multithread issues by g++ (and is
part of the C++ standard), unless you pass -fno-threadsafe-statics,
which is strongly discouraged by the man page.
»
"
2013-10-01 09:37:56 +00:00
..
CMakeLists.txt
ConvertFromInventor.cpp From Christopher Baker, submitted by Alberto Luacas, "there is a bug report in the Ubuntu tracker that points to a bug when 2013-10-01 09:37:56 +00:00
ConvertFromInventor.h With assistance from Sukender, moved the depreacted osg::Geometry vertex indices and AttributeBinding definitions out into a separated namespace/class so to use 2013-06-25 16:10:24 +00:00
ConvertToInventor.cpp With assistance from Sukender, moved the depreacted osg::Geometry vertex indices and AttributeBinding definitions out into a separated namespace/class so to use 2013-06-25 16:10:24 +00:00
ConvertToInventor.h With assistance from Sukender, moved the depreacted osg::Geometry vertex indices and AttributeBinding definitions out into a separated namespace/class so to use 2013-06-25 16:10:24 +00:00
PendulumCallback.cpp
PendulumCallback.h
ReaderWriterIV.cpp
ReaderWriterIV.h
README.txt
ShuttleCallback.cpp Converted FrameStamp::g/setFrameNumber from int to uint 2010-12-22 20:11:05 +00:00
ShuttleCallback.h

########################################################
#                                                      #
# Inventor plugin                                      #
#                                                      #
# Supported import formats:                            #
# - iv (ascii, binary) file format                     #
# - VRML 1.0                                           #
# - VRML 2.0 (when using Coin)                         #
#                                                      #
# Supported export formats:                            #
# - iv format                                          #
# - VRML 1.0                                           #
#                                                      #
########################################################


The plugin requires one of Inventor libraries:

- Coin - GPL, support of VRML 2.0
  (http://www.coin3d.org)
- SGI Inventor - LGPL
  (http://oss.sgi.com/projects/inventor/)
- TGS Inventor - commercial
  (http://www.tgs.com/)


Contributors:

Sean Spicer - Vivek (c) Magic-Earth - Original author of the Inventor reader
Gerrick Bivins
PCJohn - Jan Peciva, Cadwork (c) - author of Inventor writer, number of
                                   contributions and improvements to the reader

Minor fixes:
Ruben
Eric Sokolosky
Martin Aumueller