From 2e761512add35fc719b5e5f5ef3315577777124c Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Mon, 25 Sep 2023 11:52:18 -0400 Subject: 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. --- source/slang/slang-ast-builder.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'source/slang/slang-ast-builder.cpp') 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) -- cgit v1.2.3