Skip to content

Commit b1799b8

Browse files
Zegerieagleivg
authored andcommitted
Use xrCore's locks instead of std::mutex
I suggest that in the future Lock should become a wrapper of std::mutex and the current Lock should be renamed to RecursiveLock.
1 parent 1786320 commit b1799b8

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/xrUICore/XML/UITextureMaster.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313
#include "uiabstract.h"
1414
#include "xrUIXmlParser.h"
1515
#include "Include/xrRender/UIShader.h"
16+
#include "xrCore/Threading/Lock.hpp"
17+
#include "xrCore/Threading/ScopeLock.hpp"
1618
#include <iostream>
17-
#include <mutex>
1819

1920
xr_map<shared_str, TEX_INFO> CUITextureMaster::m_textures;
2021
xr_map<sh_pair, ui_shader> CUITextureMaster::m_shaders;
@@ -55,10 +56,8 @@ void CUITextureMaster::ParseShTexInfo(pcstr path, pcstr xml_file)
5556
/* avo: fix issue when values were not updated (silently skipped) when same key is encountered more than once. This is how std::map is designed.
5657
/* Also used more efficient C++11 std::map::emplace method instead of outdated std::pair::make_pair */
5758
/* XXX: avo: note that xxx.insert(mk_pair(v1,v2)) pattern is used extensively throughout solution so there is a good potential for other bug fixes/improvements */
58-
#ifdef LINUX
59-
static std::mutex new_texture_mutex;
60-
std::scoped_lock new_texture_lock (new_texture_mutex);
61-
#endif
59+
static Lock new_texture_lock;
60+
ScopeLock new_texture_guard(&new_texture_lock);
6261
if (m_textures.find(id) == m_textures.end())
6362
m_textures.emplace(id, info);
6463
else

0 commit comments

Comments
 (0)