mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-13 12:14:17 +01:00
Make ImcChecker threadsafe.
This commit is contained in:
parent
0064c4c96e
commit
a585976190
1 changed files with 9 additions and 5 deletions
|
|
@ -12,12 +12,16 @@ public class ImcChecker
|
||||||
|
|
||||||
public static int GetVariantCount(ImcIdentifier identifier)
|
public static int GetVariantCount(ImcIdentifier identifier)
|
||||||
{
|
{
|
||||||
if (VariantCounts.TryGetValue(identifier, out var count))
|
lock (VariantCounts)
|
||||||
return count;
|
{
|
||||||
|
if (VariantCounts.TryGetValue(identifier, out var 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