mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Minor mutex rearrangement
This commit is contained in:
+2
-2
@@ -162,8 +162,6 @@ gb_internal void override_entity_in_scope(Entity *original_entity, Entity *new_e
|
|||||||
if (found_scope == nullptr) {
|
if (found_scope == nullptr) {
|
||||||
return;
|
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
|
// 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
|
// 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
|
// 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
|
// 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);
|
string_map_set(&found_scope->elements, original_name, new_entity);
|
||||||
|
rw_mutex_unlock(&found_scope->mutex);
|
||||||
|
|
||||||
original_entity->flags |= EntityFlag_Overridden;
|
original_entity->flags |= EntityFlag_Overridden;
|
||||||
original_entity->type = new_entity->type;
|
original_entity->type = new_entity->type;
|
||||||
|
|||||||
+2
-1
@@ -36,7 +36,8 @@ gb_internal void mpsc_destroy(MPSCQueue<T> *q) {
|
|||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
gb_internal MPSCNode<T> *mpsc_alloc_node(MPSCQueue<T> *q, T const &value) {
|
gb_internal MPSCNode<T> *mpsc_alloc_node(MPSCQueue<T> *q, T const &value) {
|
||||||
auto new_node = gb_alloc_item(heap_allocator(), MPSCNode<T>);
|
// auto new_node = gb_alloc_item(heap_allocator(), MPSCNode<T>);
|
||||||
|
auto new_node = gb_alloc_item(permanent_allocator(), MPSCNode<T>);
|
||||||
new_node->value = value;
|
new_node->value = value;
|
||||||
return new_node;
|
return new_node;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user