Fixed the mutex problem
parent
7817f8412d
commit
33aa987589
|
@ -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];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue