Added re-entrent mutex to serialize access to OpenFlight plugin to prevent

any multi-threaded issues.
This commit is contained in:
Robert Osfield
2005-05-24 10:37:18 +00:00
parent 2369b20f70
commit 3ba6ce887b
2 changed files with 8 additions and 1 deletions

View File

@@ -25,6 +25,9 @@ osgDB::ReaderWriter::ReadResult ReaderWriterFLT::readObject(const std::string& f
osgDB::ReaderWriter::ReadResult ReaderWriterFLT::readNode(const std::string& file, const osgDB::ReaderWriter::Options* options) const
{
// serialize all access to the OpenFlight plugin as its not thread safe by itself.
OpenThreads::ScopedLock<osgDB::ReentrantMutex> lock(_serializerMutex);
std::string ext = osgDB::getLowerCaseFileExtension(file);
if (!acceptsExtension(ext)) return ReadResult::FILE_NOT_HANDLED;

View File

@@ -1,4 +1,3 @@
//
// OpenFlight<68> loader for Open Scene Graph
//
@@ -39,6 +38,7 @@
#include <osgDB/Registry>
#include <osgDB/FileNameUtils>
#include <osgDB/ReentrantMutex>
namespace flt {
@@ -56,6 +56,10 @@ public:
virtual ReadResult readObject(const std::string& fileName, const osgDB::ReaderWriter::Options*) const;
virtual ReadResult readNode(const std::string& fileName, const osgDB::ReaderWriter::Options*) const;
protected:
mutable osgDB::ReentrantMutex _serializerMutex;
};