Fixed: #620 Incorrect usage of mutex in particle system loader
This commit is contained in:
parent
0953ada8c3
commit
16835cc4b6
1 changed files with 9 additions and 7 deletions
|
@ -39,7 +39,11 @@ namespace NL3D {
|
||||||
using NLMISC::CIFile;
|
using NLMISC::CIFile;
|
||||||
|
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
NLMISC::CMutex s_PSSMutex;
|
||||||
|
|
||||||
|
} /* anonymous namespace */
|
||||||
|
|
||||||
// private usage : macro to check the memory integrity
|
// private usage : macro to check the memory integrity
|
||||||
#if defined(NL_DEBUG) && defined(NL_OS_WINDOWS)
|
#if defined(NL_DEBUG) && defined(NL_OS_WINDOWS)
|
||||||
|
@ -220,9 +224,8 @@ CParticleSystem *CParticleSystemShape::instanciatePS(CScene &scene, NLMISC::CCon
|
||||||
return _SharedSystem;
|
return _SharedSystem;
|
||||||
}
|
}
|
||||||
|
|
||||||
// avoid prb with concurent thread (may append if an instance group containing ps is loaded in background)
|
// avoid prb with concurrent thread (may happen if an instance group containing ps is loaded in background)
|
||||||
NLMISC::CMutex mutex;
|
s_PSSMutex.enter();
|
||||||
mutex.enter();
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef PS_FAST_ALLOC
|
#ifdef PS_FAST_ALLOC
|
||||||
|
@ -295,7 +298,7 @@ CParticleSystem *CParticleSystemShape::instanciatePS(CScene &scene, NLMISC::CCon
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
mutex.leave();
|
s_PSSMutex.leave();
|
||||||
|
|
||||||
/*NLMISC::TTicks end = NLMISC::CTime::getPerformanceTime();
|
/*NLMISC::TTicks end = NLMISC::CTime::getPerformanceTime();
|
||||||
nlinfo("instanciation time = %.2f", (float) (1000 * NLMISC::CTime::ticksToSecond(end - start))); */
|
nlinfo("instanciation time = %.2f", (float) (1000 * NLMISC::CTime::ticksToSecond(end - start))); */
|
||||||
|
@ -390,8 +393,7 @@ void CParticleSystemShape::flushTextures(IDriver &driver, uint selectedTexture)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NLMISC::CMutex mutex;
|
s_PSSMutex.enter();
|
||||||
mutex.enter();
|
|
||||||
|
|
||||||
// must create an instance just to flush the textures
|
// must create an instance just to flush the textures
|
||||||
CParticleSystem *myInstance = NULL;
|
CParticleSystem *myInstance = NULL;
|
||||||
|
@ -436,7 +438,7 @@ void CParticleSystemShape::flushTextures(IDriver &driver, uint selectedTexture)
|
||||||
#ifdef PS_FAST_ALLOC
|
#ifdef PS_FAST_ALLOC
|
||||||
PSBlockAllocator = NULL;
|
PSBlockAllocator = NULL;
|
||||||
#endif
|
#endif
|
||||||
mutex.leave();
|
s_PSSMutex.leave();
|
||||||
}
|
}
|
||||||
for(uint k = 0; k < _CachedTex.size(); ++k)
|
for(uint k = 0; k < _CachedTex.size(); ++k)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue