aboutsummaryrefslogtreecommitdiff
path: root/src/checker.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/checker.cpp')
-rw-r--r--src/checker.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/checker.cpp b/src/checker.cpp
index 9568b8cfa..71ccfebc4 100644
--- a/src/checker.cpp
+++ b/src/checker.cpp
@@ -495,15 +495,18 @@ gb_internal Entity *scope_insert_with_name(Scope *s, String const &name, Entity
goto end;
}
if (s->parent != nullptr && (s->parent->flags & ScopeFlag_Proc) != 0) {
+ rw_mutex_shared_lock(&s->parent->mutex);
found = string_map_get(&s->parent->elements, key);
if (found) {
if ((*found)->flags & EntityFlag_Result) {
if (entity != *found) {
result = *found;
}
+ rw_mutex_shared_unlock(&s->parent->mutex);
goto end;
}
}
+ rw_mutex_shared_unlock(&s->parent->mutex);
}
string_map_set(&s->elements, key, entity);