Define which mutexes are blocking and recursive explicitly

This commit is contained in:
gingerBill
2021-07-27 23:14:01 +01:00
parent 4bc3796f9b
commit a5d6fda433
14 changed files with 151 additions and 133 deletions

View File

@@ -661,7 +661,7 @@ gb_global Type *t_map_header = nullptr;
gb_global Type *t_equal_proc = nullptr;
gb_global Type *t_hasher_proc = nullptr;
gb_global gbMutex g_type_mutex;
gb_global RecursiveMutex g_type_mutex;
i64 type_size_of (Type *t);
@@ -677,7 +677,7 @@ bool is_type_slice(Type *t);
bool is_type_integer(Type *t);
void init_type_mutex(void) {
gb_mutex_init(&g_type_mutex);
mutex_init(&g_type_mutex);
}
bool type_ptr_set_exists(PtrSet<Type *> *s, Type *t) {
@@ -2850,8 +2850,8 @@ i64 type_align_of_internal(Type *t, TypePath *path) {
if (t->failure) {
return FAILURE_ALIGNMENT;
}
gb_mutex_lock(&g_type_mutex);
defer (gb_mutex_unlock(&g_type_mutex));
mutex_lock(&g_type_mutex);
defer (mutex_unlock(&g_type_mutex));
t = base_type(t);
@@ -3046,8 +3046,8 @@ Array<i64> type_set_offsets_of(Array<Entity *> const &fields, bool is_packed, bo
}
bool type_set_offsets(Type *t) {
gb_mutex_lock(&g_type_mutex);
defer (gb_mutex_unlock(&g_type_mutex));
mutex_lock(&g_type_mutex);
defer (mutex_unlock(&g_type_mutex));
t = base_type(t);
if (t->kind == Type_Struct) {
@@ -3077,8 +3077,8 @@ i64 type_size_of_internal(Type *t, TypePath *path) {
if (t->failure) {
return FAILURE_SIZE;
}
gb_mutex_lock(&g_type_mutex);
defer (gb_mutex_unlock(&g_type_mutex));
mutex_lock(&g_type_mutex);
defer (mutex_unlock(&g_type_mutex));
switch (t->kind) {