fix: stop when philo dead

This commit is contained in:
Camille Chauvet 2023-04-19 14:02:44 +00:00
parent c674f68b2e
commit 9281e9f508

4
main.c
View File

@ -53,8 +53,8 @@ void check_routine(t_data *data)
{ {
if ((ssize_t) get_min_meal(data) == data->nb_meals) if ((ssize_t) get_min_meal(data) == data->nb_meals)
{ {
printf("g pu faim\n");
stop(data); stop(data);
printf("g pu faim\n");
return ; return ;
} }
i = 0; i = 0;
@ -67,6 +67,7 @@ void check_routine(t_data *data)
if (ok == 1) if (ok == 1)
{ {
print_died(philo); print_died(philo);
stop(data);
return ; return ;
} }
i++; i++;
@ -78,6 +79,7 @@ int main(int ac, char **av)
{ {
t_data data; t_data data;
get_time();
if (parsing(&data, av + 1, ac - 1)) if (parsing(&data, av + 1, ac - 1))
return (1); return (1);
if (data_init(&data)) if (data_init(&data))