From 891431c1be8f1acc9329505997d5504ed549d587 Mon Sep 17 00:00:00 2001 From: Camille Chauvet Date: Tue, 25 Apr 2023 14:39:07 +0000 Subject: [PATCH] fix: work with odd numbers of philos --- philo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/philo.c b/philo.c index e4e3c60..3f5f2f0 100644 --- a/philo.c +++ b/philo.c @@ -87,7 +87,7 @@ void *philo_routine(void *arg) philo = arg; data = philo->data; print_thinking(philo); - usleep((philo->id * (data->life_expectency / data->nb_philos)) * 1000); + usleep((philo->id % 2) * (data->eat_time) * 1000); while (true) { if (check(philo, data))