mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-02 20:58:15 +00:00
Enforce atomic on hasher id
This commit is contained in:
@@ -304,10 +304,10 @@ gb_internal lbValue lb_hasher_proc_for_type(lbModule *m, Type *type) {
|
|||||||
return {(*found)->value, (*found)->type};
|
return {(*found)->value, (*found)->type};
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 proc_index = 0;
|
static std::atomic<u32> proc_index = 0;
|
||||||
|
|
||||||
char buf[32] = {};
|
char buf[32] = {};
|
||||||
isize n = gb_snprintf(buf, 32, "__$hasher%u", ++proc_index);
|
isize n = gb_snprintf(buf, 32, "__$hasher%u", 1+proc_index.fetch_add(1));
|
||||||
char *str = gb_alloc_str_len(permanent_allocator(), buf, n-1);
|
char *str = gb_alloc_str_len(permanent_allocator(), buf, n-1);
|
||||||
String proc_name = make_string_c(str);
|
String proc_name = make_string_c(str);
|
||||||
|
|
||||||
|
|||||||
@@ -2619,6 +2619,7 @@ gb_internal lbValue lb_find_procedure_value_from_entity(lbModule *m, Entity *e)
|
|||||||
|
|
||||||
lbProcedure *missing_proc = lb_create_procedure(m, e, ignore_body);
|
lbProcedure *missing_proc = lb_create_procedure(m, e, ignore_body);
|
||||||
if (ignore_body) {
|
if (ignore_body) {
|
||||||
|
GB_ASSERT(other_module != nullptr);
|
||||||
mutex_lock(&other_module->values_mutex);
|
mutex_lock(&other_module->values_mutex);
|
||||||
auto *found = map_get(&other_module->values, e);
|
auto *found = map_get(&other_module->values, e);
|
||||||
if (found == nullptr) {
|
if (found == nullptr) {
|
||||||
|
|||||||
Reference in New Issue
Block a user