From 992cad101c495e9a0c96a46c0eb50f6a59c7e68f Mon Sep 17 00:00:00 2001 From: gingerBill Date: Wed, 10 Sep 2025 21:16:56 +0100 Subject: [PATCH] Minor mutex rearrangement --- src/check_decl.cpp | 4 ++-- src/queue.cpp | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/check_decl.cpp b/src/check_decl.cpp index ff888b74e..58e4f0120 100644 --- a/src/check_decl.cpp +++ b/src/check_decl.cpp @@ -162,8 +162,6 @@ gb_internal void override_entity_in_scope(Entity *original_entity, Entity *new_e if (found_scope == nullptr) { return; } - rw_mutex_lock(&found_scope->mutex); - defer (rw_mutex_unlock(&found_scope->mutex)); // IMPORTANT NOTE(bill, 2021-04-10): Overriding behaviour was flawed in that the // original entity was still used check checked, but the checking was only @@ -172,7 +170,9 @@ gb_internal void override_entity_in_scope(Entity *original_entity, Entity *new_e // Therefore two things can be done: the type can be assigned to state that it // has been "evaluated" and the variant data can be copied across + rw_mutex_lock(&found_scope->mutex); string_map_set(&found_scope->elements, original_name, new_entity); + rw_mutex_unlock(&found_scope->mutex); original_entity->flags |= EntityFlag_Overridden; original_entity->type = new_entity->type; diff --git a/src/queue.cpp b/src/queue.cpp index dee9ad1f8..82f82f3e1 100644 --- a/src/queue.cpp +++ b/src/queue.cpp @@ -36,7 +36,8 @@ gb_internal void mpsc_destroy(MPSCQueue *q) { template gb_internal MPSCNode *mpsc_alloc_node(MPSCQueue *q, T const &value) { - auto new_node = gb_alloc_item(heap_allocator(), MPSCNode); + // auto new_node = gb_alloc_item(heap_allocator(), MPSCNode); + auto new_node = gb_alloc_item(permanent_allocator(), MPSCNode); new_node->value = value; return new_node; }