mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-14 04:34:19 +01:00
Make ImcChecker threadsafe.
This commit is contained in:
parent
0064c4c96e
commit
a585976190
1 changed files with 9 additions and 5 deletions
|
|
@ -11,14 +11,18 @@ public class ImcChecker
|
||||||
|
|
||||||
|
|
||||||
public static int GetVariantCount(ImcIdentifier identifier)
|
public static int GetVariantCount(ImcIdentifier identifier)
|
||||||
|
{
|
||||||
|
lock (VariantCounts)
|
||||||
{
|
{
|
||||||
if (VariantCounts.TryGetValue(identifier, out var count))
|
if (VariantCounts.TryGetValue(identifier, out var count))
|
||||||
return count;
|
return count;
|
||||||
|
|
||||||
count = GetFile(identifier)?.Count ?? 0;
|
count = GetFile(identifier)?.Count ?? 0;
|
||||||
VariantCounts[identifier] = count;
|
VariantCounts[identifier] = count;
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public readonly record struct CachedEntry(ImcEntry Entry, bool FileExists, bool VariantExists);
|
public readonly record struct CachedEntry(ImcEntry Entry, bool FileExists, bool VariantExists);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue