From 802ea8347d1ceb7a02cf279359b3b101106fab94 Mon Sep 17 00:00:00 2001 From: Charles Cabergs Date: Sat, 9 Jan 2021 16:07:01 +0100 Subject: Added separate thread to check if max meal num is reached independent from philosopher death --- philo_three/src/event.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'philo_three/src/event.c') diff --git a/philo_three/src/event.c b/philo_three/src/event.c index 1c7fa14..a7b6d2a 100644 --- a/philo_three/src/event.c +++ b/philo_three/src/event.c @@ -6,7 +6,7 @@ /* By: cacharle +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/14 21:37:50 by cacharle #+# #+# */ -/* Updated: 2021/01/08 20:25:44 by charles ### ########.fr */ +/* Updated: 2021/01/09 15:48:12 by charles ### ########.fr */ /* */ /* ************************************************************************** */ @@ -51,17 +51,8 @@ void event_sleep(t_philo *philo) void event_die(t_philo *philo) { - long int i; - sem_wait(philo->sem_stdout); philo_put(philo->id, EVENT_DIE, philo->initial_time); philo_put_flush(); - if (philo->conf->meal_num == -1) - sem_post(philo->sem_finish); - else - { - i = -1; - while (++i < philo->conf->philo_num) - sem_post(philo->sem_finish); - } + sem_post(philo->sem_finish); } -- cgit