Skip to content

Commit

Permalink
Make tag index thread-safe
Browse files Browse the repository at this point in the history
  • Loading branch information
HebaruSan committed Oct 6, 2023
1 parent b90be25 commit eb3045e
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions Core/Registry/Registry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -712,9 +712,12 @@ public Dictionary<string, ModuleTag> Tags
{
get
{
if (tags == null)
lock (tagMutex)
{
BuildTagIndex();
if (tags == null)
{
BuildTagIndex();
}
}
return tags;
}
Expand All @@ -725,14 +728,19 @@ public HashSet<string> Untagged
{
get
{
if (untagged == null)
lock (tagMutex)
{
BuildTagIndex();
if (untagged == null)
{
BuildTagIndex();
}
}
return untagged;
}
}

private object tagMutex = new object();

/// <summary>
/// Assemble a mapping from tags to modules
/// </summary>
Expand Down

0 comments on commit eb3045e

Please sign in to comment.