From 33aa987589cc28f079a8f539299ad6f91fa45582 Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Sun, 19 Jan 2020 12:16:54 -0800 Subject: [PATCH] Fixed the mutex problem --- platform_mac/mac_4ed.mm | 3 ++- platform_mac/mac_4ed_functions.mm | 4 ---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/platform_mac/mac_4ed.mm b/platform_mac/mac_4ed.mm index 2033dc50..87e1f0d0 100644 --- a/platform_mac/mac_4ed.mm +++ b/platform_mac/mac_4ed.mm @@ -301,6 +301,7 @@ mac_to_object(Plat_Handle handle){ function void mac_init_recursive_mutex(pthread_mutex_t *mutex){ pthread_mutexattr_t attr; + pthread_mutexattr_init(&attr); pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); pthread_mutex_init(mutex, &attr); } @@ -1370,4 +1371,4 @@ main(int arg_count, char **args){ // NOTE(yuval): Start the app's run loop [NSApp run]; } -} \ No newline at end of file +} diff --git a/platform_mac/mac_4ed_functions.mm b/platform_mac/mac_4ed_functions.mm index 98ce3121..93b19ce6 100644 --- a/platform_mac/mac_4ed_functions.mm +++ b/platform_mac/mac_4ed_functions.mm @@ -748,10 +748,8 @@ mac_memory_allocate_extended(void *base, u64 size, String_Const_u8 location){ pthread_mutex_lock(&memory_tracker_mutex); { - zdll_assert_good(Memory_Annotation_Tracker_Node, memory_tracker.first); zdll_push_back(memory_tracker.first, memory_tracker.last, node); memory_tracker.count += 1; - zdll_assert_good(Memory_Annotation_Tracker_Node, memory_tracker.first); } pthread_mutex_unlock(&memory_tracker_mutex); @@ -769,10 +767,8 @@ mac_memory_free_extended(void *ptr){ pthread_mutex_lock(&memory_tracker_mutex); { - zdll_assert_good(Memory_Annotation_Tracker_Node, memory_tracker.first); zdll_remove(memory_tracker.first, memory_tracker.last, node); memory_tracker.count -= 1; - zdll_assert_good(Memory_Annotation_Tracker_Node, memory_tracker.first); } pthread_mutex_unlock(&memory_tracker_mutex);