From 622c2bf226fd720d6ed004d33ebaa7f61c0a9f18 Mon Sep 17 00:00:00 2001 From: Camille Chauvet Date: Wed, 19 Apr 2023 11:59:37 +0000 Subject: [PATCH] fix: lock mutex --- main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main.c b/main.c index dd35aa2..f915f7f 100644 --- a/main.c +++ b/main.c @@ -19,7 +19,9 @@ size_t get_min_meal(t_data *data) t_philo *philo; philo = data->philos[0]; + pthread_mutex_lock(&philo->nb_meal_mutex); min = philo->nb_meal; + pthread_mutex_unlock(&philo->nb_meal_mutex); i = 1; while (i < data->nb_philos) {