mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-05 09:09:04 +08:00
fix(sysman): fixes multithread access issue with FDCache
Related-To: NEO-9720 Signed-off-by: Kulkarni, Ashwin Kumar <ashwin.kumar.kulkarni@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
f395bdbdab
commit
a064388ba8
@@ -45,6 +45,7 @@ void FdCacheInterface::eraseLeastUsedEntryFromCache() {
|
||||
}
|
||||
|
||||
int FdCacheInterface::getFd(std::string file) {
|
||||
std::unique_lock<std::mutex> lock(fdMutex);
|
||||
int fd = -1;
|
||||
if (fdMap.find(file) == fdMap.end()) {
|
||||
fd = NEO::SysCalls::open(file.c_str(), O_RDONLY);
|
||||
@@ -550,4 +551,4 @@ bool SysFsAccessInterface::isRootUser() {
|
||||
}
|
||||
|
||||
} // namespace Sysman
|
||||
} // namespace L0
|
||||
} // namespace L0
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
|
||||
namespace L0 {
|
||||
@@ -31,6 +32,7 @@ class FdCacheInterface {
|
||||
std::map<std::string, std::pair<int, uint32_t>> fdMap = {};
|
||||
|
||||
private:
|
||||
std::mutex fdMutex{};
|
||||
void eraseLeastUsedEntryFromCache();
|
||||
};
|
||||
|
||||
@@ -142,4 +144,4 @@ class SysFsAccessInterface : protected FsAccessInterface {
|
||||
};
|
||||
|
||||
} // namespace Sysman
|
||||
} // namespace L0
|
||||
} // namespace L0
|
||||
|
||||
Reference in New Issue
Block a user