Add a way to acquire file archives mutex
This commit is contained in:
parent
8df6bdf7c8
commit
661a57b5fc
@ -9,6 +9,8 @@
|
||||
#include "IXMLReader.h"
|
||||
#include "IFileArchive.h"
|
||||
|
||||
#include <mutex>
|
||||
|
||||
namespace irr
|
||||
{
|
||||
namespace video
|
||||
@ -386,6 +388,8 @@ public:
|
||||
If you no longer need the object, you should call IAttributes::drop().
|
||||
See IReferenceCounted::drop() for more information. */
|
||||
virtual IAttributes* createEmptyAttributes(video::IVideoDriver* driver=0) =0;
|
||||
|
||||
virtual std::unique_lock<std::recursive_mutex> acquireFileArchivesMutex() const = 0;
|
||||
};
|
||||
|
||||
|
||||
|
@ -1092,6 +1092,12 @@ IAttributes* CFileSystem::createEmptyAttributes(video::IVideoDriver* driver)
|
||||
}
|
||||
|
||||
|
||||
std::unique_lock<std::recursive_mutex> CFileSystem::acquireFileArchivesMutex() const
|
||||
{
|
||||
return std::unique_lock<std::recursive_mutex>(m_file_archives_mutex);
|
||||
}
|
||||
|
||||
|
||||
} // end namespace irr
|
||||
} // end namespace io
|
||||
|
||||
|
@ -8,8 +8,6 @@
|
||||
#include "IFileSystem.h"
|
||||
#include "irrArray.h"
|
||||
|
||||
#include <mutex>
|
||||
|
||||
namespace irr
|
||||
{
|
||||
namespace io
|
||||
@ -159,6 +157,8 @@ public:
|
||||
//! Creates a new empty collection of attributes, usable for serialization and more.
|
||||
virtual IAttributes* createEmptyAttributes(video::IVideoDriver* driver);
|
||||
|
||||
virtual std::unique_lock<std::recursive_mutex> acquireFileArchivesMutex() const;
|
||||
|
||||
private:
|
||||
|
||||
// don't expose, needs refactoring
|
||||
|
@ -633,6 +633,8 @@ io::path FileManager::createAbsoluteFilename(const std::string &f)
|
||||
void FileManager::pushModelSearchPath(const std::string& path)
|
||||
{
|
||||
m_model_search_path.push_back(path);
|
||||
std::unique_lock<std::recursive_mutex> ul = m_file_system->acquireFileArchivesMutex();
|
||||
|
||||
const int n=m_file_system->getFileArchiveCount();
|
||||
m_file_system->addFileArchive(createAbsoluteFilename(path),
|
||||
/*ignoreCase*/false,
|
||||
@ -660,6 +662,8 @@ void FileManager::pushModelSearchPath(const std::string& path)
|
||||
void FileManager::pushTextureSearchPath(const std::string& path, const std::string& container_id)
|
||||
{
|
||||
m_texture_search_path.push_back(TextureSearchPath(path, container_id));
|
||||
std::unique_lock<std::recursive_mutex> ul = m_file_system->acquireFileArchivesMutex();
|
||||
|
||||
const int n=m_file_system->getFileArchiveCount();
|
||||
m_file_system->addFileArchive(createAbsoluteFilename(path),
|
||||
/*ignoreCase*/false,
|
||||
|
Loading…
x
Reference in New Issue
Block a user