From 275a12ace3d2ab0cb5939513d6d6c46e88a0a687 Mon Sep 17 00:00:00 2001 From: adjoly Date: Wed, 14 Aug 2024 18:06:46 +0200 Subject: [PATCH] =?UTF-8?q?=E3=80=8C=F0=9F=94=A8=E3=80=8D=20fix:=20fixed?= =?UTF-8?q?=20death=20after=20eating=20all=20meal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- philo/monitor.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/philo/monitor.c b/philo/monitor.c index e70a010..3000356 100644 --- a/philo/monitor.c +++ b/philo/monitor.c @@ -6,7 +6,7 @@ /* By: adjoly +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/08/12 12:13:35 by adjoly #+# #+# */ -/* Updated: 2024/08/13 10:46:19 by adjoly ### ########.fr */ +/* Updated: 2024/08/14 18:03:06 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ @@ -25,7 +25,7 @@ bool philo_check(t_philo *philo, t_pdata data) gettimeofday(&t1, NULL); pthread_mutex_lock(philo->check); - if (get_time_in_ms(philo[i].eat, t1) > data.die_time + 1) + if (get_time_in_ms(philo[i].eat, t1) > data.die_time + 1 && philo[i].meal_left > 0) { pthread_mutex_unlock(philo->check); pthread_mutex_unlock(&philo[i].fork.left);