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
@@ -46,6 +46,7 @@ void FdCache::eraseLeastUsedEntryFromCache() {
|
||||
}
|
||||
|
||||
int FdCache::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);
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <sys/stat.h>
|
||||
@@ -41,6 +42,7 @@ class FdCache {
|
||||
std::map<std::string, std::pair<int, uint32_t>> fdMap = {};
|
||||
|
||||
private:
|
||||
std::mutex fdMutex{};
|
||||
void eraseLeastUsedEntryFromCache();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user