diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2023-09-25 11:52:18 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-25 11:52:18 -0400 |
| commit | 2e761512add35fc719b5e5f5ef3315577777124c (patch) | |
| tree | c91f9e02c8f8607ace76ad9a60744fe2cfd8748f /source/slang/slang-ast-builder.cpp | |
| parent | ab04bd0dd7dd6a818bbac8c5fef9372c4f597352 (diff) | |
Fix for threading issues around global session & epoch ids. (#3232)
* Fix for threading issues around global session & epoch ids.
* Make m_epochId atomic for thread visibility.
Diffstat (limited to 'source/slang/slang-ast-builder.cpp')
| -rw-r--r-- | source/slang/slang-ast-builder.cpp | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/source/slang/slang-ast-builder.cpp b/source/slang/slang-ast-builder.cpp index 4a3756c1f..b2d1e5c09 100644 --- a/source/slang/slang-ast-builder.cpp +++ b/source/slang/slang-ast-builder.cpp @@ -221,12 +221,6 @@ Decl* SharedASTBuilder::tryFindMagicDecl(const String& name) // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ASTBuilder !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -Index& _getGlobalASTEpochId() -{ - static thread_local Index epochId = 1; - return epochId; -} - ASTBuilder::ASTBuilder(SharedASTBuilder* sharedASTBuilder, const String& name): m_sharedASTBuilder(sharedASTBuilder), m_name(name), @@ -260,12 +254,12 @@ ASTBuilder::~ASTBuilder() Index ASTBuilder::getEpoch() { - return _getGlobalASTEpochId(); + return getSharedASTBuilder()->m_session->m_epochId; } void ASTBuilder::incrementEpoch() { - _getGlobalASTEpochId()++; + getSharedASTBuilder()->m_session->m_epochId++; } NodeBase* ASTBuilder::createByNodeType(ASTNodeType nodeType) |
