Clarify RwLocks for add_dependenies_from_unpacking

This commit is contained in:
gingerBill
2023-01-03 15:37:35 +00:00
parent 3dee3205b2
commit 485c606672
2 changed files with 2 additions and 10 deletions

View File

@@ -4928,23 +4928,21 @@ gb_internal bool check_identifier_exists(Scope *s, Ast *node, bool nested = fals
gb_internal isize add_dependencies_from_unpacking(CheckerContext *c, Entity **lhs, isize lhs_count, isize tuple_index, isize tuple_count) {
if (lhs != nullptr && c->decl != nullptr) {
// mutex_lock(&c->info->deps_mutex);
for (isize j = 0; (tuple_index + j) < lhs_count && j < tuple_count; j++) {
Entity *e = lhs[tuple_index + j];
if (e != nullptr) {
DeclInfo *decl = decl_info_of_entity(e);
if (decl != nullptr) {
rw_mutex_shared_lock(&decl->deps_mutex);
rw_mutex_lock(&c->decl->deps_mutex);
for (Entity *dep : decl->deps) {
ptr_set_add(&c->decl->deps, dep);
}
rw_mutex_unlock(&c->decl->deps_mutex);
rw_mutex_shared_unlock(&decl->deps_mutex);
}
}
}
// mutex_unlock(&c->info->deps_mutex);
}
return tuple_count;
}