Also, move any static local mutexes up to global level.
using namespace osgDB;
using namespace simgear;
+using OpenThreads::ReentrantMutex;
+using OpenThreads::ScopedLock;
+
// Little helper class that holds an extra reference to a
// loaded 3d model.
// Since we clone all structural nodes from our 3d models,
ModelRegistry::readImage(const string& fileName,
const ReaderWriter::Options* opt)
{
- OpenThreads::ScopedLock<OpenThreads::ReentrantMutex> lock(readerMutex);
+ ScopedLock<ReentrantMutex> lock(readerMutex);
CallbackMap::iterator iter
= imageCallbackMap.find(getFileExtension(fileName));
// XXX Workaround for OSG plugin bug
ModelRegistry::readNode(const string& fileName,
const ReaderWriter::Options* opt)
{
- OpenThreads::ScopedLock<OpenThreads::ReentrantMutex> lock(readerMutex);
+ ScopedLock<ReentrantMutex> lock(readerMutex);
// XXX Workaround for OSG plugin bug.
OptionsPusher pusher(opt);
Registry* registry = Registry::instance();
#include "SGRotateTransform.hxx"
#include "SGScaleTransform.hxx"
+using OpenThreads::Mutex;
+using OpenThreads::ReentrantMutex;
+using OpenThreads::ScopedLock;
+
\f
////////////////////////////////////////////////////////////////////////
// Static utility functions.
namespace
{
-OpenThreads::Mutex normalizeMutex;
+Mutex normalizeMutex;
osg::StateSet* getNormalizeStateSet()
{
static osg::ref_ptr<osg::StateSet> normalizeStateSet;
- OpenThreads::ScopedLock<OpenThreads::Mutex> lock(normalizeMutex);
+ ScopedLock<Mutex> lock(normalizeMutex);
if (!normalizeStateSet.valid()) {
normalizeStateSet = new osg::StateSet;
normalizeStateSet->setMode(GL_NORMALIZE, osg::StateAttribute::ON);
namespace
{
// Keep one copy of the most common alpha test its state set.
-OpenThreads::ReentrantMutex alphaTestMutex;
+ReentrantMutex alphaTestMutex;
osg::ref_ptr<osg::AlphaFunc> standardAlphaFunc;
osg::ref_ptr<osg::StateSet> alphaFuncStateSet;
osg::AlphaFunc* makeAlphaFunc(float clamp)
{
- using namespace OpenThreads;
ScopedLock<ReentrantMutex> lock(alphaTestMutex);
if (osg::equivalent(clamp, 0.01f)) {
if (standardAlphaFunc.valid())
#include <osg/Texture1D>
#include <osgUtil/HighlightMapGenerator>
+#include <OpenThreads/Mutex>
+#include <OpenThreads/ScopedLock>
+
#include <simgear/scene/util/SGUpdateVisitor.hxx>
-#include <simgear/threads/SGThread.hxx>
-#include <simgear/threads/SGGuard.hxx>
#include <simgear/props/condition.hxx>
#include <simgear/props/props.hxx>
#include "animation.hxx"
#include "model.hxx"
+
+using OpenThreads::Mutex;
+using OpenThreads::ScopedLock;
+
/*
<animation>
<type>shader</type>
SGVec4f _lastLightColor;
};
+static Mutex cubeMutex;
+
static osg::TextureCubeMap*
getOrCreateTextureCubeMap()
{
if (textureCubeMap.get())
return textureCubeMap.get();
- static SGMutex mutex;
- SGGuard<SGMutex> locker(mutex);
+ ScopedLock<Mutex> lock(cubeMutex);
if (textureCubeMap.get())
return textureCubeMap.get();
StateSetMap;
}
+static Mutex chromeMutex;
+
// The chrome effect is mixed by the alpha channel of the texture
// on the model, which will be attached to a node lower in the scene
// graph: 0 -> completely chrome, 1 -> completely model texture.
static void create_chrome(osg::Group* group, osg::Texture2D* texture)
{
- static SGMutex mutex;
- SGGuard<SGMutex> locker(mutex);
+ ScopedLock<Mutex> lock(chromeMutex);
static StateSetMap chromeMap;
osg::StateSet *stateSet;
StateSetMap::iterator iterator = chromeMap.find(texture);
#include <simgear/scene/util/SGUpdateVisitor.hxx>
#include <simgear/scene/util/SGNodeMasks.hxx>
#include <simgear/scene/util/QuadTreeBuilder.hxx>
-#include <simgear/threads/SGThread.hxx>
-#include <simgear/threads/SGGuard.hxx>
#include "SGTexturedTriangleBin.hxx"
#include "SGLightBin.hxx"
#include <osgUtil/CullVisitor>
+#include <OpenThreads/Mutex>
+#include <OpenThreads/ScopedLock>
+
#include <simgear/math/sg_random.h>
#include <simgear/debug/logstream.hxx>
-#include <simgear/threads/SGThread.hxx>
-#include <simgear/threads/SGGuard.hxx>
#include <simgear/scene/util/RenderConstants.hxx>
#include <simgear/scene/util/SGEnlargeBoundingBox.hxx>
#include "SGVasiDrawable.hxx"
+using OpenThreads::Mutex;
+using OpenThreads::ScopedLock;
+
using namespace simgear;
static void
return image;
}
+static Mutex lightMutex;
+
static osg::Texture2D*
gen_standard_light_sprite(void)
{
if (texture.valid())
return texture.get();
- static SGMutex mutex;
- SGGuard<SGMutex> guard(mutex);
+ ScopedLock<Mutex> lock(lightMutex);
if (texture.valid())
return texture.get();