aboutsummaryrefslogtreecommitdiff
path: root/src/entity.cpp
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2026-02-02 11:37:19 +0000
committerGitHub <noreply@github.com>2026-02-02 11:37:19 +0000
commitadf56ced22de0ef84100c70b394641c272231c3f (patch)
treeee049d3ffa61d7ce1de1b774b4844a0ea7bfcc00 /src/entity.cpp
parentb9e4007cb190c1a5d96e7786e726dcbcac1d08c9 (diff)
parentb183b1219c3b336988e53235a0671958b5079c09 (diff)
Merge pull request #6215 from odin-lang/bill/fix-data-races-2026-02
Fix numerous data races
Diffstat (limited to 'src/entity.cpp')
-rw-r--r--src/entity.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/entity.cpp b/src/entity.cpp
index 55aca8069..070b05462 100644
--- a/src/entity.cpp
+++ b/src/entity.cpp
@@ -170,7 +170,7 @@ struct Entity {
Type * type;
std::atomic<Ast *> identifier; // Can be nullptr
DeclInfo * decl_info;
- DeclInfo * parent_proc_decl; // nullptr if in file/global scope
+ std::atomic<DeclInfo *> parent_proc_decl; // nullptr if in file/global scope
AstFile * file;
AstPackage *pkg;
@@ -181,11 +181,11 @@ struct Entity {
Entity * aliased_of;
union {
- struct lbModule *code_gen_module;
+ std::atomic<struct lbModule *> code_gen_module;
struct cgModule *cg_module;
};
union {
- struct lbProcedure *code_gen_procedure;
+ std::atomic<struct lbProcedure *> code_gen_procedure;
struct cgProcedure *cg_procedure;
};
@@ -370,7 +370,7 @@ gb_internal Entity *alloc_entity_using_variable(Entity *parent, Token token, Typ
token.pos = parent->token.pos;
Entity *entity = alloc_entity(Entity_Variable, parent->scope, token, type);
entity->using_parent = parent;
- entity->parent_proc_decl = parent->parent_proc_decl;
+ entity->parent_proc_decl.store(parent->parent_proc_decl, std::memory_order_relaxed);
entity->using_expr = using_expr;
entity->flags |= EntityFlag_Using;
entity->flags |= EntityFlag_Used;