mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-06 17:10:13 +00:00
Further optimize InMemoryServerListProvider and make it thread-safe
This commit is contained in:
@@ -102,6 +102,21 @@ namespace ArchiSteamFarm {
|
||||
}
|
||||
}
|
||||
|
||||
internal bool ReplaceIfNeededWith(HashSet<T> items) {
|
||||
Lock.EnterUpgradeableReadLock();
|
||||
|
||||
try {
|
||||
if (HashSet.SetEquals(items)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ReplaceWith(items);
|
||||
return true;
|
||||
} finally {
|
||||
Lock.ExitUpgradeableReadLock();
|
||||
}
|
||||
}
|
||||
|
||||
internal void ReplaceWith(IEnumerable<T> items) {
|
||||
Lock.EnterWriteLock();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user