Skip to content

Commit

Permalink
Experiment: Make option dictionaries concurrent to avoid losses.
Browse files Browse the repository at this point in the history
  • Loading branch information
MikaelMayer committed Aug 16, 2024
1 parent 7e92b41 commit 6effa12
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Source/DafnyCore/Options/OptionRegistry.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#nullable enable

using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.CommandLine;
using System.Linq;
Expand Down Expand Up @@ -30,8 +31,8 @@ public static void CheckOptionsAreKnown(IEnumerable<Option> allOptions) {
// Note that legacy CLI options are not as cleanly enumerated and therefore
// more difficult to completely categorize, which is the main reason the LibraryBackend
// is restricted to only the new CLI.
private static readonly Dictionary<Option, GlobalOptionCheck> GlobalOptionChecks = new();
private static readonly Dictionary<Option, OptionScope> OptionScopes = new();
private static readonly ConcurrentDictionary<Option, GlobalOptionCheck> GlobalOptionChecks = new();
private static readonly ConcurrentDictionary<Option, OptionScope> OptionScopes = new();

public static IEnumerable<Option> GlobalOptions => GlobalOptionChecks.Keys;
public static IEnumerable<Option> TranslationOptions => OptionScopes.Where(kv => kv.Value == OptionScope.Translation).Select(kv => kv.Key);
Expand Down

0 comments on commit 6effa12

Please sign in to comment.