mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 10:17:22 +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)
|
||||
{
|
||||
if (VariantCounts.TryGetValue(identifier, out var count))
|
||||
return count;
|
||||
lock (VariantCounts)
|
||||
{
|
||||
if (VariantCounts.TryGetValue(identifier, out var count))
|
||||
return count;
|
||||
|
||||
count = GetFile(identifier)?.Count ?? 0;
|
||||
VariantCounts[identifier] = count;
|
||||
return count;
|
||||
count = GetFile(identifier)?.Count ?? 0;
|
||||
VariantCounts[identifier] = count;
|
||||
|
||||
return count;
|
||||
}
|
||||
}
|
||||
|
||||
public readonly record struct CachedEntry(ImcEntry Entry, bool FileExists, bool VariantExists);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue