Added re-entrent mutex to serialize access to OpenFlight plugin to prevent
any multi-threaded issues.
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user