- don't put mutexes into static local variables.

Their initialization semantics are not safe for synchronization objects.
This commit is contained in:
Christoph Oelckers 2018-12-08 11:56:31 +01:00
commit 92b722e0ee
3 changed files with 5 additions and 9 deletions

View file

@ -74,6 +74,7 @@ void PolyRenderThread::FlushDrawQueue()
}
}
static std::mutex loadmutex;
void PolyRenderThread::PrepareTexture(FTexture *texture, FRenderStyle style)
{
if (texture == nullptr)
@ -87,8 +88,6 @@ void PolyRenderThread::PrepareTexture(FTexture *texture, FRenderStyle style)
// It is critical that this function is called before any direct
// calls to GetPixels for this to work.
static std::mutex loadmutex;
std::unique_lock<std::mutex> lock(loadmutex);
texture->GetPixels(style);
@ -101,10 +100,9 @@ void PolyRenderThread::PrepareTexture(FTexture *texture, FRenderStyle style)
}
}
static std::mutex polyobjmutex;
void PolyRenderThread::PreparePolyObject(subsector_t *sub)
{
static std::mutex polyobjmutex;
std::unique_lock<std::mutex> lock(polyobjmutex);
if (sub->BSP == nullptr || sub->BSP->bDirty)