Fix non threadsafe code
This commit is contained in:
parent
c6b03555f7
commit
1a498348ee
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user