mirror of
https://github.com/Ed94/Odin.git
synced 2026-06-24 22:54:59 -07:00
Fix race condition with -use-separate-modules due to type determination
This commit is contained in:
@@ -1498,6 +1498,9 @@ gb_internal LLVMTypeRef lb_type_internal_for_procedures_raw(lbModule *m, Type *t
|
||||
type = base_type(original_type);
|
||||
GB_ASSERT(type->kind == Type_Proc);
|
||||
|
||||
mutex_lock(&m->func_raw_types_mutex);
|
||||
defer (mutex_unlock(&m->func_raw_types_mutex));
|
||||
|
||||
LLVMTypeRef *found = map_get(&m->func_raw_types, type);
|
||||
if (found) {
|
||||
return *found;
|
||||
@@ -2157,6 +2160,9 @@ gb_internal LLVMTypeRef lb_type_internal(lbModule *m, Type *type) {
|
||||
gb_internal LLVMTypeRef lb_type(lbModule *m, Type *type) {
|
||||
type = default_type(type);
|
||||
|
||||
mutex_lock(&m->types_mutex);
|
||||
defer (mutex_unlock(&m->types_mutex));
|
||||
|
||||
LLVMTypeRef *found = map_get(&m->types, type);
|
||||
if (found) {
|
||||
return *found;
|
||||
|
||||
Reference in New Issue
Block a user