Fix non threadsafe code

This commit is contained in:
fredb 2008-06-01 17:25:05 +00:00
parent c6b03555f7
commit 1a498348ee

View File

@ -44,14 +44,14 @@ SGSceneFeatures::SGSceneFeatures() :
{ {
} }
static SGMutex mutexSGSceneFeatures_instance;
SGSceneFeatures* SGSceneFeatures*
SGSceneFeatures::instance() SGSceneFeatures::instance()
{ {
static SGSharedPtr<SGSceneFeatures> sceneFeatures; static SGSharedPtr<SGSceneFeatures> sceneFeatures;
if (sceneFeatures) if (sceneFeatures)
return sceneFeatures; return sceneFeatures;
static SGMutex mutex; SGGuard<SGMutex> guard(mutexSGSceneFeatures_instance);
SGGuard<SGMutex> guard(mutex);
if (sceneFeatures) if (sceneFeatures)
return sceneFeatures; return sceneFeatures;
sceneFeatures = new SGSceneFeatures; sceneFeatures = new SGSceneFeatures;