Use RwMutex for the Scope

This commit is contained in:
gingerBill
2023-01-03 15:26:47 +00:00
parent 0fb3032b73
commit c7a704d345
7 changed files with 138 additions and 29 deletions

View File

@@ -622,7 +622,10 @@ gb_internal bool check_using_stmt_entity(CheckerContext *ctx, AstUsingStmt *us,
case Entity_ImportName: {
Scope *scope = e->ImportName.scope;
MUTEX_GUARD_BLOCK(scope->mutex) for (auto const &entry : scope->elements) {
rw_mutex_lock(&scope->mutex);
defer (rw_mutex_unlock(&scope->mutex));
for (auto const &entry : scope->elements) {
String name = entry.key.string;
Entity *decl = entry.value;
if (!is_entity_exported(decl)) continue;