mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-18 12:33:17 +01:00
Use correct lock.
This commit is contained in:
@@ -30,7 +30,7 @@ TextureCache::~TextureCache()
|
||||
|
||||
void TextureCache::InvalidateImage(uint32_t image)
|
||||
{
|
||||
std::unique_lock<std::shared_mutex> lock(_mutex);
|
||||
unique_lock lock(_mutex);
|
||||
|
||||
uint32_t index = _indexMap[image];
|
||||
if (index == UNUSED_INDEX)
|
||||
@@ -83,7 +83,7 @@ BasicTextureInfo TextureCache::GetOrLoadImageTexture(uint32_t image)
|
||||
}
|
||||
|
||||
// Load new texture.
|
||||
std::unique_lock<std::shared_mutex> lock(_mutex);
|
||||
unique_lock lock(_mutex);
|
||||
|
||||
index = (uint32_t)_textureCache.size();
|
||||
|
||||
@@ -118,7 +118,7 @@ BasicTextureInfo TextureCache::GetOrLoadGlyphTexture(uint32_t image, uint8_t* pa
|
||||
}
|
||||
|
||||
// Load new texture.
|
||||
std::unique_lock<std::shared_mutex> lock(_mutex);
|
||||
unique_lock lock(_mutex);
|
||||
|
||||
auto cacheInfo = LoadGlyphTexture(image, palette);
|
||||
auto it = _glyphTextureMap.insert(std::make_pair(glyphId, cacheInfo));
|
||||
|
||||
@@ -206,9 +206,11 @@ private:
|
||||
#ifndef __MACOSX__
|
||||
std::shared_mutex _mutex;
|
||||
typedef std::shared_lock<std::shared_mutex> shared_lock;
|
||||
typedef std::unique_lock<std::shared_mutex> unique_lock;
|
||||
#else
|
||||
std::mutex _mutex;
|
||||
typedef std::unique_lock<std::mutex> shared_lock;
|
||||
typedef std::unique_lock<std::mutex> unique_lock;
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user