diff --git a/philo/src/12.dinner_routines.c b/philo/src/12.dinner_routines.c index 38534a8..6a10edf 100644 --- a/philo/src/12.dinner_routines.c +++ b/philo/src/12.dinner_routines.c @@ -6,7 +6,7 @@ /* By: umeneses +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/10/30 16:19:23 by umeneses #+# #+# */ -/* Updated: 2024/11/03 12:58:42 by umeneses ### ########.fr */ +/* Updated: 2024/11/03 15:17:01 by umeneses ### ########.fr */ /* */ /* ************************************************************************** */ @@ -75,11 +75,14 @@ void let_philo_think_routine(t_philo *philo) { long think_time; - think_time = philo->table->set.time_to_eat * 2 - philo->table->set.time_to_sleep; + think_time = 0; + if (philo->table->set.total_meals % 2 != 0) + think_time = philo->table->set.time_to_eat + * 2 - philo->table->set.time_to_sleep; + if (think_time < 0) + think_time = 0; printer_with_mutex(THINKING, philo, DEBUG_MODE); precise_usleep(think_time, philo->table); - // safe_mutex_handler(philo->philo_mtx, LOCK); - // safe_mutex_handler(philo->philo_mtx, UNLOCK); } void let_philo_sleep_routine(t_philo *philo)