diff --git a/VisualStudio/osgDB/osgDB.dsp b/VisualStudio/osgDB/osgDB.dsp index a707d1faa..8ac4e995e 100755 --- a/VisualStudio/osgDB/osgDB.dsp +++ b/VisualStudio/osgDB/osgDB.dsp @@ -215,10 +215,6 @@ SOURCE=..\..\Src\osgDB\Registry.cpp # End Source File # Begin Source File -SOURCE=..\..\Src\osgDB\ReentrantMutex.cpp -# End Source File -# Begin Source File - SOURCE=..\..\src\osgDB\SharedStateManager.cpp # End Source File # Begin Source File @@ -303,10 +299,6 @@ SOURCE=..\..\Include\osgDB\Registry # End Source File # Begin Source File -SOURCE=..\..\Include\osgDB\ReentrantMutex -# End Source File -# Begin Source File - SOURCE=..\..\Include\osgDB\SharedStateManager # End Source File # Begin Source File diff --git a/VisualStudio/osgWrappers/osgDB/wrapper_osgDB.dsp b/VisualStudio/osgWrappers/osgDB/wrapper_osgDB.dsp index 24e4850ab..40213333c 100644 --- a/VisualStudio/osgWrappers/osgDB/wrapper_osgDB.dsp +++ b/VisualStudio/osgWrappers/osgDB/wrapper_osgDB.dsp @@ -147,10 +147,6 @@ SOURCE=..\..\..\src\osgWrappers\osgDB\ParameterOutput.cpp SOURCE=..\..\..\src\osgWrappers\osgDB\ReaderWriter.cpp # End Source File -# Begin Source File -SOURCE=..\..\..\src\osgWrappers\osgDB\ReentrantMutex.cpp -# End Source File - # Begin Source File SOURCE=..\..\..\src\osgWrappers\osgDB\Registry.cpp # End Source File diff --git a/Xcode/OpenSceneGraph/OpenSceneGraph.xcodeproj/project.pbxproj b/Xcode/OpenSceneGraph/OpenSceneGraph.xcodeproj/project.pbxproj index e8c76f7bb..741c6c97b 100644 --- a/Xcode/OpenSceneGraph/OpenSceneGraph.xcodeproj/project.pbxproj +++ b/Xcode/OpenSceneGraph/OpenSceneGraph.xcodeproj/project.pbxproj @@ -1910,9 +1910,7 @@ 00E2813D07676504005AEE61 /* dxtctool.h in Headers */ = {isa = PBXBuildFile; fileRef = 00E2813A07676502005AEE61 /* dxtctool.h */; }; 00E2813E07676504005AEE61 /* TexEnvFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00E2813B07676503005AEE61 /* TexEnvFilter.cpp */; }; 00E2814107676629005AEE61 /* Archive in Headers */ = {isa = PBXBuildFile; fileRef = 00E2813F07676626005AEE61 /* Archive */; settings = {ATTRIBUTES = (Public, ); }; }; - 00E2814207676629005AEE61 /* ReentrantMutex in Headers */ = {isa = PBXBuildFile; fileRef = 00E2814007676628005AEE61 /* ReentrantMutex */; settings = {ATTRIBUTES = (Public, ); }; }; 00E28145076766DA005AEE61 /* Archive.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00E28143076766D7005AEE61 /* Archive.cpp */; }; - 00E28146076766DA005AEE61 /* ReentrantMutex.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00E28144076766D9005AEE61 /* ReentrantMutex.cpp */; }; 00E28148076767D2005AEE61 /* NodeTrackerManipulator in Headers */ = {isa = PBXBuildFile; fileRef = 00E28147076767D1005AEE61 /* NodeTrackerManipulator */; settings = {ATTRIBUTES = (Public, ); }; }; 00E2814A07676854005AEE61 /* NodeTrackerManipulator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00E2814907676852005AEE61 /* NodeTrackerManipulator.cpp */; }; 00E281A607676B93005AEE61 /* FindExternalModelVisitor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00E281A407676B91005AEE61 /* FindExternalModelVisitor.cpp */; }; @@ -6053,9 +6051,7 @@ 00E2813A07676502005AEE61 /* dxtctool.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; fileEncoding = 30; name = dxtctool.h; path = ../../src/osg/dxtctool.h; sourceTree = SOURCE_ROOT; }; 00E2813B07676503005AEE61 /* TexEnvFilter.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; fileEncoding = 30; name = TexEnvFilter.cpp; path = ../../src/osg/TexEnvFilter.cpp; sourceTree = SOURCE_ROOT; }; 00E2813F07676626005AEE61 /* Archive */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp; fileEncoding = 30; name = Archive; path = ../../include/osgDB/Archive; sourceTree = SOURCE_ROOT; }; - 00E2814007676628005AEE61 /* ReentrantMutex */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp; fileEncoding = 30; name = ReentrantMutex; path = ../../include/osgDB/ReentrantMutex; sourceTree = SOURCE_ROOT; }; 00E28143076766D7005AEE61 /* Archive.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Archive.cpp; path = ../../src/osgDB/Archive.cpp; sourceTree = SOURCE_ROOT; }; - 00E28144076766D9005AEE61 /* ReentrantMutex.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = ReentrantMutex.cpp; path = ../../src/osgDB/ReentrantMutex.cpp; sourceTree = SOURCE_ROOT; }; 00E28147076767D1005AEE61 /* NodeTrackerManipulator */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp; fileEncoding = 30; path = NodeTrackerManipulator; sourceTree = ""; }; 00E2814907676852005AEE61 /* NodeTrackerManipulator.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; fileEncoding = 30; name = NodeTrackerManipulator.cpp; path = ../../src/osgGA/NodeTrackerManipulator.cpp; sourceTree = SOURCE_ROOT; }; 00E281A407676B91005AEE61 /* FindExternalModelVisitor.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; fileEncoding = 30; name = FindExternalModelVisitor.cpp; path = ../../src/osgPlugins/flt/FindExternalModelVisitor.cpp; sourceTree = SOURCE_ROOT; }; @@ -11506,7 +11502,6 @@ BE1188F405D765CD00EB53E5 /* Output.cpp */, BE1188F505D765CD00EB53E5 /* ReadFile.cpp */, 008F446B06CBF99E00F4220C /* ReaderWriter.cpp */, - 00E28144076766D9005AEE61 /* ReentrantMutex.cpp */, BE1188F605D765CD00EB53E5 /* Registry.cpp */, BE1188F705D765CD00EB53E5 /* SharedStateManager.cpp */, BE1188F805D765CD00EB53E5 /* Version.cpp */, @@ -11534,7 +11529,6 @@ BE11891705D7665600EB53E5 /* ParameterOutput */, BE11891805D7665600EB53E5 /* ReaderWriter */, BE11891905D7665600EB53E5 /* ReadFile */, - 00E2814007676628005AEE61 /* ReentrantMutex */, BE11891A05D7665600EB53E5 /* Registry */, BE11891B05D7665600EB53E5 /* SharedStateManager */, BE11891C05D7665600EB53E5 /* Version */, @@ -13274,7 +13268,6 @@ BE11892A05D7665600EB53E5 /* ParameterOutput in Headers */, BE11892B05D7665600EB53E5 /* ReaderWriter in Headers */, BE11892C05D7665600EB53E5 /* ReadFile in Headers */, - 00E2814207676629005AEE61 /* ReentrantMutex in Headers */, BE11892D05D7665600EB53E5 /* Registry in Headers */, BE11892E05D7665600EB53E5 /* SharedStateManager in Headers */, BE11892F05D7665600EB53E5 /* Version in Headers */, @@ -19037,7 +19030,6 @@ BE11890A05D765CE00EB53E5 /* WriteFile.cpp in Sources */, 008F446C06CBF99E00F4220C /* ReaderWriter.cpp in Sources */, 00E28145076766DA005AEE61 /* Archive.cpp in Sources */, - 00E28146076766DA005AEE61 /* ReentrantMutex.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/examples/osgphotoalbum/ImageReaderWriter.h b/examples/osgphotoalbum/ImageReaderWriter.h index 6d69c647b..60527221b 100644 --- a/examples/osgphotoalbum/ImageReaderWriter.h +++ b/examples/osgphotoalbum/ImageReaderWriter.h @@ -18,11 +18,11 @@ #include #include -#include +#include #include "PhotoArchive.h" -#define SERIALIZER() OpenThreads::ScopedLock lock(_serializerMutex) +#define SERIALIZER() OpenThreads::ScopedLock lock(_serializerMutex) class ImageReaderWriter : public osgDB::ReaderWriter { @@ -53,7 +53,7 @@ class ImageReaderWriter : public osgDB::ReaderWriter ReadResult local_readNode(const std::string& fileName, const Options*); - mutable osgDB::ReentrantMutex _serializerMutex; + mutable OpenThreads::ReentrantMutex _serializerMutex; struct DataReference { diff --git a/include/osg/GraphicsContext b/include/osg/GraphicsContext index feb58e314..2fc0cec33 100644 --- a/include/osg/GraphicsContext +++ b/include/osg/GraphicsContext @@ -189,7 +189,7 @@ class OSG_EXPORT GraphicsContext : public Object OpenThreads::Mutex* getOperationsMutex() { return &_operationsMutex; } /** Get the operations queue block used to mark an empty queue, if you end items into the empty queu you must release this block.*/ - osg::Block* getOperationsBlock() { return _operationsBlock.get(); } + osg::RefBlock* getOperationsBlock() { return _operationsBlock.get(); } /** Get the current operations that is being run.*/ Operation* getCurrentOperation() { return _currentOperation.get(); } @@ -381,7 +381,7 @@ class OSG_EXPORT GraphicsContext : public Object OpenThreads::Thread* _threadOfLastMakeCurrent; OpenThreads::Mutex _operationsMutex; - osg::ref_ptr _operationsBlock; + osg::ref_ptr _operationsBlock; OperationQueue _operations; osg::ref_ptr _currentOperation; diff --git a/include/osg/GraphicsThread b/include/osg/GraphicsThread index 559b523ea..37e2dd69f 100644 --- a/include/osg/GraphicsThread +++ b/include/osg/GraphicsThread @@ -20,58 +20,18 @@ #include #include #include +#include #include namespace osg { -class Block: virtual public osg::Referenced { +class RefBlock: virtual public osg::Referenced, public OpenThreads::Block +{ public: - Block():_released(false) {} - inline void block() - { - OpenThreads::ScopedLock mutlock(_mut); - if( !_released ) - _cond.wait(&_mut); - } + RefBlock() {} - inline void release() - { - OpenThreads::ScopedLock mutlock(_mut); - if (!_released) - { - _released = true; - _cond.broadcast(); - } - } - - inline void reset() - { - OpenThreads::ScopedLock mutlock(_mut); - _released = false; - } - - inline void set(bool doRelease) - { - if (doRelease!=_released) - { - if (doRelease) release(); - else reset(); - } - } - - protected: - - ~Block() - { - release(); - } - - private: - OpenThreads::Mutex _mut; - OpenThreads::Condition _cond; - bool _released; }; /** Base class for implementing graphics operations.*/ @@ -155,7 +115,7 @@ class OSG_EXPORT OperationsThread : public Referenced, public OpenThreads::Threa bool _done; OpenThreads::Mutex _operationsMutex; - osg::ref_ptr _operationsBlock; + osg::ref_ptr _operationsBlock; OperationQueue _operations; osg::ref_ptr _currentOperation; @@ -195,7 +155,7 @@ struct OSG_EXPORT BarrierOperation : public Operation, public OpenThreads::Barri /** ReleaseContext_Block_MakeCurrentOperation releases the context for another thread to aquire, * then blocks waiting for context to be released, once the block is release the context is re-aqquired.*/ -struct OSG_EXPORT ReleaseContext_Block_MakeCurrentOperation : public Operation, public Block +struct OSG_EXPORT ReleaseContext_Block_MakeCurrentOperation : public Operation, public RefBlock { ReleaseContext_Block_MakeCurrentOperation(): Operation("ReleaseContext_Block_MakeCurrent", false) {} diff --git a/include/osgDB/DatabasePager b/include/osgDB/DatabasePager index 1553b7e2a..b3d40c764 100644 --- a/include/osgDB/DatabasePager +++ b/include/osgDB/DatabasePager @@ -84,7 +84,7 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl /** Get the whether UseFrameBlock is on or off.*/ bool getUseFrameBlock() const { return _useFrameBlock; } - osg::Block* getFrameBlock() { return _frameBlock.get(); } + osg::RefBlock* getFrameBlock() { return _frameBlock.get(); } /** Set the priority of the database pager thread during the frame (i.e. while cull and draw are running.)*/ void setThreadPriorityDuringFrame(ThreadPriority duringFrame) { _threadPriorityDuringFrame = duringFrame; } @@ -293,7 +293,7 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl bool _startThreadCalled; - osg::ref_ptr _databasePagerThreadBlock; + osg::ref_ptr _databasePagerThreadBlock; inline void updateDatabasePagerThreadBlock() { @@ -325,7 +325,7 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl bool _useFrameBlock; int _numFramesActive; mutable OpenThreads::Mutex _numFramesActiveMutex; - osg::ref_ptr _frameBlock; + osg::ref_ptr _frameBlock; int _frameNumber; ThreadPriority _threadPriorityDuringFrame; diff --git a/include/osgDB/ReentrantMutex b/include/osgDB/ReentrantMutex deleted file mode 100644 index a7359547c..000000000 --- a/include/osgDB/ReentrantMutex +++ /dev/null @@ -1,108 +0,0 @@ -/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield - * - * This library is open source and may be redistributed and/or modified under - * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or - * (at your option) any later version. The full license is in LICENSE file - * included with this distribution, and on the openscenegraph.org website. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * OpenSceneGraph Public License for more details. -*/ - -#ifndef OSGDB_REENTRANTMUTEX -#define OSGDB_REENTRANTMUTEX - -#include -#include - -#include - -namespace osgDB { - -class OSGDB_EXPORT ReentrantMutex : public OpenThreads::Mutex -{ - public: - - ReentrantMutex(); - - virtual ~ReentrantMutex(); - - virtual int lock(); - - virtual int unlock(); - - virtual int trylock(); - - private: - - ReentrantMutex(const ReentrantMutex&):OpenThreads::Mutex() {} - - ReentrantMutex& operator =(const ReentrantMutex&) { return *(this); } - - OpenThreads::Thread* _threadHoldingMutex; - - OpenThreads::Mutex _lockCountMutex; - unsigned int _lockCount; - -}; - -class OSGDB_EXPORT ReadWriteMutex -{ - public: - - ReadWriteMutex(); - - virtual ~ReadWriteMutex(); - - virtual int readLock(); - - virtual int readUnlock(); - - virtual int writeLock(); - - virtual int writeUnlock(); - - protected: - - ReadWriteMutex(const ReadWriteMutex&) {} - ReadWriteMutex& operator = (const ReadWriteMutex&) { return *(this); } - -#if 0 - ReentrantMutex _readWriteMutex; - ReentrantMutex _readCountMutex; -#else - OpenThreads::Mutex _readWriteMutex; - OpenThreads::Mutex _readCountMutex; -#endif - unsigned int _readCount; - -}; - -class ScopedReadLock -{ - public: - - ScopedReadLock(ReadWriteMutex& mutex):_mutex(mutex) { _mutex.readLock(); } - ~ScopedReadLock() { _mutex.readUnlock(); } - - protected: - ReadWriteMutex& _mutex; -}; - - -class ScopedWriteLock -{ - public: - - ScopedWriteLock(ReadWriteMutex& mutex):_mutex(mutex) { _mutex.writeLock(); } - ~ScopedWriteLock() { _mutex.writeUnlock(); } - - protected: - ReadWriteMutex& _mutex; -}; - -} - -#endif diff --git a/include/osgParticle/ParticleSystem b/include/osgParticle/ParticleSystem index 529c1825d..79d8d63fd 100644 --- a/include/osgParticle/ParticleSystem +++ b/include/osgParticle/ParticleSystem @@ -30,7 +30,7 @@ #include #include -#include +#include namespace osgParticle { @@ -166,7 +166,7 @@ namespace osgParticle virtual osg::BoundingBox computeBound() const; - osgDB::ReadWriteMutex* getReadWriteMutex() const { return &_readWriteMutex; } + OpenThreads::ReadWriteMutex* getReadWriteMutex() const { return &_readWriteMutex; } protected: @@ -205,7 +205,7 @@ namespace osgParticle int _detail; mutable int _draw_count; - mutable osgDB::ReadWriteMutex _readWriteMutex; + mutable OpenThreads::ReadWriteMutex _readWriteMutex; }; diff --git a/src/osg/GraphicsContext.cpp b/src/osg/GraphicsContext.cpp index 24d1bdc38..83c2df9d4 100644 --- a/src/osg/GraphicsContext.cpp +++ b/src/osg/GraphicsContext.cpp @@ -137,7 +137,7 @@ GraphicsContext::GraphicsContext(): _threadOfLastMakeCurrent(0) { setThreadSafeRefUnref(true); - _operationsBlock = new Block; + _operationsBlock = new RefBlock; } GraphicsContext::GraphicsContext(const GraphicsContext&, const osg::CopyOp&): @@ -146,7 +146,7 @@ GraphicsContext::GraphicsContext(const GraphicsContext&, const osg::CopyOp&): _threadOfLastMakeCurrent(0) { setThreadSafeRefUnref(true); - _operationsBlock = new Block; + _operationsBlock = new RefBlock; } GraphicsContext::~GraphicsContext() diff --git a/src/osg/GraphicsThread.cpp b/src/osg/GraphicsThread.cpp index 2e137303b..ab1c1cdd1 100644 --- a/src/osg/GraphicsThread.cpp +++ b/src/osg/GraphicsThread.cpp @@ -44,7 +44,7 @@ OperationsThread::OperationsThread(): _parent(0), _done(false) { - _operationsBlock = new Block; + _operationsBlock = new RefBlock; } OperationsThread::~OperationsThread() diff --git a/src/osgDB/DatabasePager.cpp b/src/osgDB/DatabasePager.cpp index 528f22b18..fad0f0ddc 100644 --- a/src/osgDB/DatabasePager.cpp +++ b/src/osgDB/DatabasePager.cpp @@ -37,8 +37,8 @@ DatabasePager::DatabasePager() _useFrameBlock = false; _numFramesActive = 0; _frameNumber = 0; - _frameBlock = new osg::Block; - _databasePagerThreadBlock = new osg::Block; + _frameBlock = new osg::RefBlock; + _databasePagerThreadBlock = new osg::RefBlock; _threadPriorityDuringFrame = THREAD_PRIORITY_MIN; _threadPriorityOutwithFrame = THREAD_PRIORITY_MIN; diff --git a/src/osgDB/GNUmakefile b/src/osgDB/GNUmakefile index 022067c13..d914f5502 100644 --- a/src/osgDB/GNUmakefile +++ b/src/osgDB/GNUmakefile @@ -9,7 +9,6 @@ CXXFILES =\ FileUtils.cpp\ ReadFile.cpp\ ReaderWriter.cpp\ - ReentrantMutex.cpp\ Registry.cpp\ Version.cpp\ WriteFile.cpp\ diff --git a/src/osgParticle/ConnectedParticleSystem.cpp b/src/osgParticle/ConnectedParticleSystem.cpp index 120ea3149..f166473ef 100644 --- a/src/osgParticle/ConnectedParticleSystem.cpp +++ b/src/osgParticle/ConnectedParticleSystem.cpp @@ -114,7 +114,7 @@ void ConnectedParticleSystem::reuseParticle(int particleIndex) void ConnectedParticleSystem::drawImplementation(osg::State& state) const { - osgDB::ScopedReadLock lock(_readWriteMutex); + OpenThreads::ScopedReadLock lock(_readWriteMutex); const Particle* particle = (_startParticle != Particle::INVALID_INDEX) ? &_particles[_startParticle] : 0; if (!particle) return; diff --git a/src/osgParticle/ParticleProcessor.cpp b/src/osgParticle/ParticleProcessor.cpp index f66203aba..e19313ee7 100644 --- a/src/osgParticle/ParticleProcessor.cpp +++ b/src/osgParticle/ParticleProcessor.cpp @@ -64,7 +64,7 @@ void osgParticle::ParticleProcessor::traverse(osg::NodeVisitor& nv) { if (nv.getFrameStamp()) { - osgDB::ScopedWriteLock lock(*(_ps->getReadWriteMutex())); + OpenThreads::ScopedWriteLock lock(*(_ps->getReadWriteMutex())); //added- 1/17/06- bgandere@nps.edu //a check to make sure we havent updated yet this frame diff --git a/src/osgParticle/ParticleSystem.cpp b/src/osgParticle/ParticleSystem.cpp index 69e1359ae..65c2f2511 100644 --- a/src/osgParticle/ParticleSystem.cpp +++ b/src/osgParticle/ParticleSystem.cpp @@ -91,7 +91,7 @@ void osgParticle::ParticleSystem::update(double dt) void osgParticle::ParticleSystem::drawImplementation(osg::State& state) const { - osgDB::ScopedReadLock lock(_readWriteMutex); + OpenThreads::ScopedReadLock lock(_readWriteMutex); // update the frame count, so other objects can detect when // this particle system is culled diff --git a/src/osgParticle/ParticleSystemUpdater.cpp b/src/osgParticle/ParticleSystemUpdater.cpp index e252910b7..7785f5890 100644 --- a/src/osgParticle/ParticleSystemUpdater.cpp +++ b/src/osgParticle/ParticleSystemUpdater.cpp @@ -40,7 +40,7 @@ void osgParticle::ParticleSystemUpdater::traverse(osg::NodeVisitor& nv) { ParticleSystem* ps = i->get(); - osgDB::ScopedWriteLock lock(*(ps->getReadWriteMutex())); + OpenThreads::ScopedWriteLock lock(*(ps->getReadWriteMutex())); if (!ps->isFrozen() && (ps->getLastFrameNumber() >= (nv.getFrameStamp()->getFrameNumber() - 1) || !ps->getFreezeOnCull())) { diff --git a/src/osgPlugins/OpenFlight/ReaderWriterFLT.cpp b/src/osgPlugins/OpenFlight/ReaderWriterFLT.cpp index 311901470..b922e9c36 100644 --- a/src/osgPlugins/OpenFlight/ReaderWriterFLT.cpp +++ b/src/osgPlugins/OpenFlight/ReaderWriterFLT.cpp @@ -11,14 +11,14 @@ #include #include #include -#include +#include #include #include "Registry.h" #include "Document.h" #include "RecordInputStream.h" -#define SERIALIZER() OpenThreads::ScopedLock lock(_serializerMutex) +#define SERIALIZER() OpenThreads::ScopedLock lock(_serializerMutex) using namespace flt; using namespace osg; @@ -279,7 +279,7 @@ class FLTReaderWriter : public ReaderWriter protected: - mutable osgDB::ReentrantMutex _serializerMutex; + mutable OpenThreads::ReentrantMutex _serializerMutex; }; // now register with Registry to instantiate the above diff --git a/src/osgPlugins/dae/ReaderWriterDAE.cpp b/src/osgPlugins/dae/ReaderWriterDAE.cpp index b85b1775d..ad2c8c478 100644 --- a/src/osgPlugins/dae/ReaderWriterDAE.cpp +++ b/src/osgPlugins/dae/ReaderWriterDAE.cpp @@ -18,14 +18,14 @@ #include #include -#include +#include #include "daeReader.h" #include "daeWriter.h" #define EXTENSION_NAME "dae" -#define SERIALIZER() OpenThreads::ScopedLock lock(_serializerMutex) +#define SERIALIZER() OpenThreads::ScopedLock lock(_serializerMutex) /////////////////////////////////////////////////////////////////////////// // OSG reader/writer plugin for the COLLADA 1.4.x ".dae" format. @@ -61,7 +61,7 @@ public: private: mutable DAE *_dae; - mutable osgDB::ReentrantMutex _serializerMutex; + mutable OpenThreads::ReentrantMutex _serializerMutex; }; diff --git a/src/osgPlugins/flt/ReaderWriterFLT.cpp b/src/osgPlugins/flt/ReaderWriterFLT.cpp index 3e8436c34..53ceffdb9 100644 --- a/src/osgPlugins/flt/ReaderWriterFLT.cpp +++ b/src/osgPlugins/flt/ReaderWriterFLT.cpp @@ -26,7 +26,7 @@ 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 lock(_serializerMutex); + OpenThreads::ScopedLock lock(_serializerMutex); std::string ext = osgDB::getLowerCaseFileExtension(file); if (!acceptsExtension(ext)) return ReadResult::FILE_NOT_HANDLED; diff --git a/src/osgPlugins/flt/ReaderWriterFLT.h b/src/osgPlugins/flt/ReaderWriterFLT.h index 4c61ec49f..3a3b65df6 100644 --- a/src/osgPlugins/flt/ReaderWriterFLT.h +++ b/src/osgPlugins/flt/ReaderWriterFLT.h @@ -38,7 +38,7 @@ #include #include -#include +#include namespace flt { @@ -59,7 +59,7 @@ public: protected: - mutable osgDB::ReentrantMutex _serializerMutex; + mutable OpenThreads::ReentrantMutex _serializerMutex; }; diff --git a/src/osgPlugins/gdal/ReaderWriterGDAL.cpp b/src/osgPlugins/gdal/ReaderWriterGDAL.cpp index 8303e6cf7..0fcb33c7f 100644 --- a/src/osgPlugins/gdal/ReaderWriterGDAL.cpp +++ b/src/osgPlugins/gdal/ReaderWriterGDAL.cpp @@ -9,11 +9,11 @@ #include #include -#include +#include #include -#define SERIALIZER() OpenThreads::ScopedLock lock(_serializerMutex) +#define SERIALIZER() OpenThreads::ScopedLock lock(_serializerMutex) // From easyrgb.com float Hue_2_RGB( float v1, float v2, float vH ) @@ -37,13 +37,13 @@ class ReaderWriterGDAL : public osgDB::ReaderWriter virtual ReadResult readImage(const std::string& fileName, const osgDB::ReaderWriter::Options* options) const { - OpenThreads::ScopedLock lock(_serializerMutex); + OpenThreads::ScopedLock lock(_serializerMutex); return const_cast(this)->local_readImage(fileName, options); } virtual ReadResult readHeightField(const std::string& fileName, const osgDB::ReaderWriter::Options* options) const { - OpenThreads::ScopedLock lock(_serializerMutex); + OpenThreads::ScopedLock lock(_serializerMutex); return const_cast(this)->local_readHeightField(fileName, options); } @@ -729,7 +729,7 @@ class ReaderWriterGDAL : public osgDB::ReaderWriter } } - mutable osgDB::ReentrantMutex _serializerMutex; + mutable OpenThreads::ReentrantMutex _serializerMutex; }; diff --git a/src/osgPlugins/osga/OSGA_Archive.h b/src/osgPlugins/osga/OSGA_Archive.h index 679b085b5..30e5dc31b 100644 --- a/src/osgPlugins/osga/OSGA_Archive.h +++ b/src/osgPlugins/osga/OSGA_Archive.h @@ -16,9 +16,9 @@ #include #include -#include +#include -#define SERIALIZER() OpenThreads::ScopedLock lock(_serializerMutex) +#define SERIALIZER() OpenThreads::ScopedLock lock(_serializerMutex) class OSGA_Archive : public osgDB::Archive { @@ -93,7 +93,7 @@ class OSGA_Archive : public osgDB::Archive protected: - mutable osgDB::ReentrantMutex _serializerMutex; + mutable OpenThreads::ReentrantMutex _serializerMutex; class IndexBlock; friend class IndexBlock; diff --git a/src/osgPlugins/txp/ReaderWriterTXP.h b/src/osgPlugins/txp/ReaderWriterTXP.h index 1e27afb6e..b8173f46a 100644 --- a/src/osgPlugins/txp/ReaderWriterTXP.h +++ b/src/osgPlugins/txp/ReaderWriterTXP.h @@ -44,7 +44,7 @@ #include #include -#include +#include #include "TXPArchive.h" @@ -68,7 +68,7 @@ public: if( !acceptsExtension(osgDB::getFileExtension(file) )) return ReadResult::FILE_NOT_HANDLED; - OpenThreads::ScopedLock lock(_serializerMutex); + OpenThreads::ScopedLock lock(_serializerMutex); return const_cast(this)->local_readNode(file, options); } @@ -85,7 +85,7 @@ protected: void createChildrenLocationString(const std::vector& locs, std::string& locString) const; bool extractChildrenLocations(const std::string& name, int parentLod, std::vector& locs, int nbChild) const; - mutable osgDB::ReentrantMutex _serializerMutex; + mutable OpenThreads::ReentrantMutex _serializerMutex; std::map< int,osg::ref_ptr > _archives; static int _archiveId; diff --git a/src/osgWrappers/osg/GraphicsContext.cpp b/src/osgWrappers/osg/GraphicsContext.cpp index 0ca42a2f0..b2b5b16ee 100644 --- a/src/osgWrappers/osg/GraphicsContext.cpp +++ b/src/osgWrappers/osg/GraphicsContext.cpp @@ -66,9 +66,9 @@ BEGIN_OBJECT_REFLECTOR(osg::GraphicsContext) __OpenThreads_Mutex_P1__getOperationsMutex, "Get the operations queue mutex. ", ""); - I_Method0(osg::Block *, getOperationsBlock, + I_Method0(osg::RefBlock *, getOperationsBlock, Properties::NON_VIRTUAL, - __osg_Block_P1__getOperationsBlock, + __osg_RefBlock_P1__getOperationsBlock, "Get the operations queue block used to mark an empty queue, if you end items into the empty queu you must release this block. ", ""); I_Method0(osg::Operation *, getCurrentOperation, @@ -305,8 +305,8 @@ BEGIN_OBJECT_REFLECTOR(osg::GraphicsContext) I_SimpleProperty(osg::OperationsThread *, GraphicsThread, __OperationsThread_P1__getGraphicsThread, __void__setGraphicsThread__OperationsThread_P1); - I_SimpleProperty(osg::Block *, OperationsBlock, - __osg_Block_P1__getOperationsBlock, + I_SimpleProperty(osg::RefBlock *, OperationsBlock, + __osg_RefBlock_P1__getOperationsBlock, 0); I_SimpleProperty(OpenThreads::Mutex *, OperationsMutex, __OpenThreads_Mutex_P1__getOperationsMutex, diff --git a/src/osgWrappers/osg/GraphicsThread.cpp b/src/osgWrappers/osg/GraphicsThread.cpp index bde26bcdf..52ec4e5b1 100644 --- a/src/osgWrappers/osg/GraphicsThread.cpp +++ b/src/osgWrappers/osg/GraphicsThread.cpp @@ -41,33 +41,6 @@ BEGIN_OBJECT_REFLECTOR(osg::BarrierOperation) I_PublicMemberProperty(osg::BarrierOperation::PreBlockOp, _preBlockOp); END_REFLECTOR -BEGIN_OBJECT_REFLECTOR(osg::Block) - I_VirtualBaseType(osg::Referenced); - I_Constructor0(____Block, - "", - ""); - I_Method0(void, block, - Properties::NON_VIRTUAL, - __void__block, - "", - ""); - I_Method0(void, release, - Properties::NON_VIRTUAL, - __void__release, - "", - ""); - I_Method0(void, reset, - Properties::NON_VIRTUAL, - __void__reset, - "", - ""); - I_Method1(void, set, IN, bool, doRelease, - Properties::NON_VIRTUAL, - __void__set__bool, - "", - ""); -END_REFLECTOR - BEGIN_ABSTRACT_OBJECT_REFLECTOR(osg::Operation) I_VirtualBaseType(osg::Referenced); I_Constructor2(IN, const std::string &, name, IN, bool, keep, @@ -185,16 +158,23 @@ BEGIN_OBJECT_REFLECTOR(osg::OperationsThread) __void__setParent__Object_P1); END_REFLECTOR +BEGIN_OBJECT_REFLECTOR(osg::RefBlock) + I_VirtualBaseType(osg::Referenced); + I_Constructor0(____RefBlock, + "", + ""); +END_REFLECTOR + BEGIN_OBJECT_REFLECTOR(osg::ReleaseContext_Block_MakeCurrentOperation) I_BaseType(osg::Operation); - I_BaseType(osg::Block); + I_BaseType(osg::RefBlock); I_Constructor0(____ReleaseContext_Block_MakeCurrentOperation, "", ""); I_Method0(void, release, Properties::VIRTUAL, __void__release, - "", + "if this operation is a barrier then release it. ", ""); END_REFLECTOR diff --git a/src/osgWrappers/osgDB/DatabasePager.cpp b/src/osgWrappers/osgDB/DatabasePager.cpp index e935c4ec1..07a07d1bf 100644 --- a/src/osgWrappers/osgDB/DatabasePager.cpp +++ b/src/osgWrappers/osgDB/DatabasePager.cpp @@ -108,9 +108,9 @@ BEGIN_OBJECT_REFLECTOR(osgDB::DatabasePager) __bool__getUseFrameBlock, "Get the whether UseFrameBlock is on or off. ", ""); - I_Method0(osg::Block *, getFrameBlock, + I_Method0(osg::RefBlock *, getFrameBlock, Properties::NON_VIRTUAL, - __osg_Block_P1__getFrameBlock, + __osg_RefBlock_P1__getFrameBlock, "", ""); I_Method1(void, setThreadPriorityDuringFrame, IN, osgDB::DatabasePager::ThreadPriority, duringFrame, @@ -311,8 +311,8 @@ BEGIN_OBJECT_REFLECTOR(osgDB::DatabasePager) I_SimpleProperty(unsigned int, FileRequestListSize, __unsigned_int__getFileRequestListSize, 0); - I_SimpleProperty(osg::Block *, FrameBlock, - __osg_Block_P1__getFrameBlock, + I_SimpleProperty(osg::RefBlock *, FrameBlock, + __osg_RefBlock_P1__getFrameBlock, 0); I_SimpleProperty(unsigned int, MaximumNumOfObjectsToCompilePerFrame, __unsigned_int__getMaximumNumOfObjectsToCompilePerFrame, diff --git a/src/osgWrappers/osgDB/GNUmakefile b/src/osgWrappers/osgDB/GNUmakefile index 705c3f4db..4a72828a4 100644 --- a/src/osgWrappers/osgDB/GNUmakefile +++ b/src/osgWrappers/osgDB/GNUmakefile @@ -15,7 +15,6 @@ CXXFILES =\ Output.cpp\ ParameterOutput.cpp\ ReaderWriter.cpp\ - ReentrantMutex.cpp\ Registry.cpp\ SharedStateManager.cpp\ diff --git a/src/osgWrappers/osgDB/ReentrantMutex.cpp b/src/osgWrappers/osgDB/ReentrantMutex.cpp deleted file mode 100644 index 342fde2c0..000000000 --- a/src/osgWrappers/osgDB/ReentrantMutex.cpp +++ /dev/null @@ -1,85 +0,0 @@ -// *************************************************************************** -// -// Generated automatically by genwrapper. -// Please DO NOT EDIT this file! -// -// *************************************************************************** - -#include -#include -#include -#include - -#include - -// Must undefine IN and OUT macros defined in Windows headers -#ifdef IN -#undef IN -#endif -#ifdef OUT -#undef OUT -#endif - -BEGIN_OBJECT_REFLECTOR(osgDB::ReadWriteMutex) - I_Constructor0(____ReadWriteMutex, - "", - ""); - I_Method0(int, readLock, - Properties::VIRTUAL, - __int__readLock, - "", - ""); - I_Method0(int, readUnlock, - Properties::VIRTUAL, - __int__readUnlock, - "", - ""); - I_Method0(int, writeLock, - Properties::VIRTUAL, - __int__writeLock, - "", - ""); - I_Method0(int, writeUnlock, - Properties::VIRTUAL, - __int__writeUnlock, - "", - ""); -END_REFLECTOR - -BEGIN_OBJECT_REFLECTOR(osgDB::ReentrantMutex) - I_Constructor0(____ReentrantMutex, - "", - ""); - I_Method0(int, lock, - Properties::VIRTUAL, - __int__lock, - "", - ""); - I_Method0(int, unlock, - Properties::VIRTUAL, - __int__unlock, - "", - ""); - I_Method0(int, trylock, - Properties::VIRTUAL, - __int__trylock, - "", - ""); -END_REFLECTOR - -BEGIN_VALUE_REFLECTOR(osgDB::ScopedReadLock) - I_Constructor1(IN, osgDB::ReadWriteMutex &, mutex, - Properties::NON_EXPLICIT, - ____ScopedReadLock__ReadWriteMutex_R1, - "", - ""); -END_REFLECTOR - -BEGIN_VALUE_REFLECTOR(osgDB::ScopedWriteLock) - I_Constructor1(IN, osgDB::ReadWriteMutex &, mutex, - Properties::NON_EXPLICIT, - ____ScopedWriteLock__ReadWriteMutex_R1, - "", - ""); -END_REFLECTOR - diff --git a/src/osgWrappers/osgParticle/ParticleSystem.cpp b/src/osgWrappers/osgParticle/ParticleSystem.cpp index 14ae650f8..d767df264 100644 --- a/src/osgWrappers/osgParticle/ParticleSystem.cpp +++ b/src/osgWrappers/osgParticle/ParticleSystem.cpp @@ -15,7 +15,6 @@ #include #include #include -#include #include #include @@ -231,9 +230,9 @@ BEGIN_OBJECT_REFLECTOR(osgParticle::ParticleSystem) __osg_BoundingBox__computeBound, "Compute the bounding box around Drawables's geometry. ", ""); - I_Method0(osgDB::ReadWriteMutex *, getReadWriteMutex, + I_Method0(OpenThreads::ReadWriteMutex *, getReadWriteMutex, Properties::NON_VIRTUAL, - __osgDB_ReadWriteMutex_P1__getReadWriteMutex, + __OpenThreads_ReadWriteMutex_P1__getReadWriteMutex, "", ""); I_SimpleProperty(const osg::Vec3 &, AlignVectorX, @@ -266,8 +265,8 @@ BEGIN_OBJECT_REFLECTOR(osgParticle::ParticleSystem) I_SimpleProperty(osgParticle::ParticleSystem::Alignment, ParticleAlignment, __Alignment__getParticleAlignment, __void__setParticleAlignment__Alignment); - I_SimpleProperty(osgDB::ReadWriteMutex *, ReadWriteMutex, - __osgDB_ReadWriteMutex_P1__getReadWriteMutex, + I_SimpleProperty(OpenThreads::ReadWriteMutex *, ReadWriteMutex, + __OpenThreads_ReadWriteMutex_P1__getReadWriteMutex, 0); END_REFLECTOR