mirror of
https://github.com/odin-lang/Odin.git
synced 2026-07-22 15:32:35 +00:00
Shrink lock region of func_raw_types_mutex to avoid deadlock.
This commit is contained in:
@@ -1781,13 +1781,15 @@ gb_internal LLVMTypeRef lb_type_internal_for_procedures_raw(lbModule *m, Type *t
|
||||
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) {
|
||||
mutex_unlock(&m->func_raw_types_mutex);
|
||||
return *found;
|
||||
}
|
||||
|
||||
mutex_unlock(&m->func_raw_types_mutex);
|
||||
|
||||
unsigned param_count = 0;
|
||||
|
||||
if (type->Proc.param_count != 0) {
|
||||
@@ -1896,7 +1898,9 @@ gb_internal LLVMTypeRef lb_type_internal_for_procedures_raw(lbModule *m, Type *t
|
||||
"\n\tFuncTypeCtx: %p\n\tCurrentCtx: %p\n\tGlobalCtx: %p",
|
||||
LLVMGetTypeContext(new_abi_fn_type), m->ctx);
|
||||
|
||||
mutex_lock(&m->func_raw_types_mutex);
|
||||
map_set(&m->func_raw_types, type, new_abi_fn_type);
|
||||
mutex_unlock(&m->func_raw_types_mutex);
|
||||
|
||||
return new_abi_fn_type;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user