Skip to content

Commit

Permalink
mike-lischke#139 Make global mutable state thread_local
Browse files Browse the repository at this point in the history
Signed-off-by: vityaman <[email protected]>
  • Loading branch information
vityaman authored and mike-lischke committed Aug 8, 2024
1 parent 58e4ea0 commit 5b8a86c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ports/cpp/source/antlr4-c3/CodeCompletionCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ std::vector<size_t> longestCommonPrefix(

} // namespace

std::unordered_map<std::type_index, CodeCompletionCore::FollowSetsPerState> // NOLINT
thread_local std::unordered_map<std::type_index, CodeCompletionCore::FollowSetsPerState> // NOLINT
CodeCompletionCore::followSetsByATN = {};

// Matches ATNStateType enum
Expand Down
2 changes: 1 addition & 1 deletion ports/cpp/source/antlr4-c3/CodeCompletionCore.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ class CodeCompletionCore {
CandidatesCollection collectCandidates(size_t caretTokenIndex, Parameters parameters = {});

private:
static std::unordered_map<std::type_index, FollowSetsPerState> followSetsByATN;
static thread_local std::unordered_map<std::type_index, FollowSetsPerState> followSetsByATN;
static std::vector<std::string> atnStateTypeMap;

antlr4::Parser* parser;
Expand Down

0 comments on commit 5b8a86c

Please sign in to comment.