From 7e7538aa40add21e2feececc5e3730d0bb6bbdd5 Mon Sep 17 00:00:00 2001 From: Camille Chauvet Date: Tue, 25 Apr 2023 15:10:25 +0000 Subject: [PATCH] fix: do not print message exit eating --- philo.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/philo.c b/philo.c index 65424d8..be2df7a 100644 --- a/philo.c +++ b/philo.c @@ -19,6 +19,13 @@ bool check(t_philo *philo, t_data *data) { bool stop; + if (get_min_meal(data) == data->nb_meals) + { + pthread_mutex_lock(&philo->stop_mutex); + philo->stop = 1; + pthread_mutex_unlock(&philo->stop_mutex); + return (1); + } pthread_mutex_lock(&data->stop_mutex); stop = data->stop; pthread_mutex_unlock(&data->stop_mutex);