fix print mutex is now destroyed at the end

This commit is contained in:
Camille Chauvet
2023-04-20 12:40:30 +00:00
parent 32d881a7d2
commit 26e9f21238
3 changed files with 5 additions and 3 deletions

2
data.c
View File

@ -30,6 +30,7 @@ bool data_init(t_data *data)
}
pthread_mutex_init(&data->forks_mutex, NULL);
pthread_mutex_init(&data->stop_mutex, NULL);
pthread_mutex_init(&data->print_mutex, NULL);
data->stop = 0;
return (0);
}
@ -53,6 +54,7 @@ void data_destroyer(t_data *data)
}
pthread_mutex_destroy(&data->forks_mutex);
pthread_mutex_destroy(&data->stop_mutex);
pthread_mutex_destroy(&data->print_mutex);
free(data->threads);
free(data->forks);
philos_destroyer(data);