mirror of
https://github.com/ZDoom/qzdoom.git
synced 2025-02-17 17:41:23 +00:00
- don't put mutexes into static local variables.
Their initialization semantics are not safe for synchronization objects.
This commit is contained in:
parent
e70138a266
commit
92b722e0ee
3 changed files with 5 additions and 9 deletions
|
@ -74,6 +74,7 @@ void PolyRenderThread::FlushDrawQueue()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static std::mutex loadmutex;
|
||||||
void PolyRenderThread::PrepareTexture(FTexture *texture, FRenderStyle style)
|
void PolyRenderThread::PrepareTexture(FTexture *texture, FRenderStyle style)
|
||||||
{
|
{
|
||||||
if (texture == nullptr)
|
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
|
// It is critical that this function is called before any direct
|
||||||
// calls to GetPixels for this to work.
|
// calls to GetPixels for this to work.
|
||||||
|
|
||||||
static std::mutex loadmutex;
|
|
||||||
|
|
||||||
std::unique_lock<std::mutex> lock(loadmutex);
|
std::unique_lock<std::mutex> lock(loadmutex);
|
||||||
|
|
||||||
texture->GetPixels(style);
|
texture->GetPixels(style);
|
||||||
|
@ -101,10 +100,9 @@ void PolyRenderThread::PrepareTexture(FTexture *texture, FRenderStyle style)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static std::mutex polyobjmutex;
|
||||||
void PolyRenderThread::PreparePolyObject(subsector_t *sub)
|
void PolyRenderThread::PreparePolyObject(subsector_t *sub)
|
||||||
{
|
{
|
||||||
static std::mutex polyobjmutex;
|
|
||||||
|
|
||||||
std::unique_lock<std::mutex> lock(polyobjmutex);
|
std::unique_lock<std::mutex> lock(polyobjmutex);
|
||||||
|
|
||||||
if (sub->BSP == nullptr || sub->BSP->bDirty)
|
if (sub->BSP == nullptr || sub->BSP->bDirty)
|
||||||
|
|
|
@ -89,6 +89,7 @@ namespace swrenderer
|
||||||
return pal_drawers.get();
|
return pal_drawers.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static std::mutex loadmutex;
|
||||||
void RenderThread::PrepareTexture(FTexture *texture, FRenderStyle style)
|
void RenderThread::PrepareTexture(FTexture *texture, FRenderStyle style)
|
||||||
{
|
{
|
||||||
if (texture == nullptr)
|
if (texture == nullptr)
|
||||||
|
@ -102,8 +103,6 @@ namespace swrenderer
|
||||||
// It is critical that this function is called before any direct
|
// It is critical that this function is called before any direct
|
||||||
// calls to GetPixels for this to work.
|
// calls to GetPixels for this to work.
|
||||||
|
|
||||||
static std::mutex loadmutex;
|
|
||||||
|
|
||||||
std::unique_lock<std::mutex> lock(loadmutex);
|
std::unique_lock<std::mutex> lock(loadmutex);
|
||||||
|
|
||||||
texture->GetPixels(style);
|
texture->GetPixels(style);
|
||||||
|
@ -116,10 +115,9 @@ namespace swrenderer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static std::mutex polyobjmutex;
|
||||||
void RenderThread::PreparePolyObject(subsector_t *sub)
|
void RenderThread::PreparePolyObject(subsector_t *sub)
|
||||||
{
|
{
|
||||||
static std::mutex polyobjmutex;
|
|
||||||
|
|
||||||
std::unique_lock<std::mutex> lock(polyobjmutex);
|
std::unique_lock<std::mutex> lock(polyobjmutex);
|
||||||
|
|
||||||
if (sub->BSP == nullptr || sub->BSP->bDirty)
|
if (sub->BSP == nullptr || sub->BSP->bDirty)
|
||||||
|
|
|
@ -70,12 +70,12 @@ TArray<FSWColormap> SpecialSWColormaps;
|
||||||
// Colored Lighting Stuffs
|
// Colored Lighting Stuffs
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
static std::mutex buildmapmutex;
|
||||||
|
|
||||||
static FDynamicColormap *CreateSpecialLights (PalEntry color, PalEntry fade, int desaturate)
|
static FDynamicColormap *CreateSpecialLights (PalEntry color, PalEntry fade, int desaturate)
|
||||||
{
|
{
|
||||||
// GetSpecialLights is called by the scene worker threads.
|
// GetSpecialLights is called by the scene worker threads.
|
||||||
// If we didn't find the colormap, search again, but this time one thread at a time
|
// If we didn't find the colormap, search again, but this time one thread at a time
|
||||||
static std::mutex buildmapmutex;
|
|
||||||
std::unique_lock<std::mutex> lock(buildmapmutex);
|
std::unique_lock<std::mutex> lock(buildmapmutex);
|
||||||
|
|
||||||
// If this colormap has already been created, just return it
|
// If this colormap has already been created, just return it
|
||||||
|
|
Loading…
Reference in a new issue