mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-25 15:26:17 +02:00
PosixSourceAccessor: Use SharedSync
This commit is contained in:
parent
2f39caf180
commit
fd9e49480a
1 changed files with 2 additions and 2 deletions
|
@ -90,14 +90,14 @@ bool PosixSourceAccessor::pathExists(const CanonPath & path)
|
|||
|
||||
std::optional<struct stat> PosixSourceAccessor::cachedLstat(const CanonPath & path)
|
||||
{
|
||||
static Sync<std::unordered_map<Path, std::optional<struct stat>>> _cache;
|
||||
static SharedSync<std::unordered_map<Path, std::optional<struct stat>>> _cache;
|
||||
|
||||
// Note: we convert std::filesystem::path to Path because the
|
||||
// former is not hashable on libc++.
|
||||
Path absPath = makeAbsPath(path).string();
|
||||
|
||||
{
|
||||
auto cache(_cache.lock());
|
||||
auto cache(_cache.read());
|
||||
auto i = cache->find(absPath);
|
||||
if (i != cache->end()) return i->second;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue