Use correct lock.

This commit is contained in:
Matt committed 2019-03-31 15:50:55 +02:00
1 parent 65ef018e4e
commit ce9d252ce5
2 files changed
+5 -3

No files matched your search

@@ -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: