diff options
| author | gingerBill <bill@gingerbill.org> | 2022-01-11 10:56:07 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2022-01-11 10:56:07 +0000 |
| commit | 847b05013f71c69a4123fe5a4606c88039b716a3 (patch) | |
| tree | 4d0df625a3d1f60bf4ebe89782261aa70434751d /src/checker.cpp | |
| parent | 32ec1162bf467359ed47ba0bd4e74ec0c7fbd167 (diff) | |
Disable `DEFAULT_TO_THREADED_CHECKER` until race condition is found
Diffstat (limited to 'src/checker.cpp')
| -rw-r--r-- | src/checker.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/checker.cpp b/src/checker.cpp index 58c71a176..b4c5d0c72 100644 --- a/src/checker.cpp +++ b/src/checker.cpp @@ -446,7 +446,7 @@ Entity *scope_lookup(Scope *s, String const &name) { -Entity *scope_insert_with_name(Scope *s, String const &name, Entity *entity) { +Entity *scope_insert_with_name(Scope *s, String const &name, Entity *entity, bool use_mutex=true) { if (name == "") { return nullptr; } @@ -454,8 +454,8 @@ Entity *scope_insert_with_name(Scope *s, String const &name, Entity *entity) { Entity **found = nullptr; Entity *result = nullptr; - mutex_lock(&s->mutex); - defer (mutex_unlock(&s->mutex)); + if (use_mutex) mutex_lock(&s->mutex); + defer (if (use_mutex) mutex_unlock(&s->mutex)); found = string_map_get(&s->elements, key); @@ -485,9 +485,9 @@ end:; return result; } -Entity *scope_insert(Scope *s, Entity *entity) { +Entity *scope_insert(Scope *s, Entity *entity, bool use_mutex) { String name = entity->token.string; - return scope_insert_with_name(s, name, entity); + return scope_insert_with_name(s, name, entity, use_mutex); } |