fix: stop when philo has enough eat

This commit is contained in:
Camille Chauvet 2023-04-20 13:16:02 +00:00
parent 26e9f21238
commit b553e5af97

13
main.c
View File

@ -52,12 +52,6 @@ void *check_routine(t_data *data)
while (true)
{
if ((ssize_t) get_min_meal(data) == data->nb_meals)
{
stop(data);
printf("g pu faim\n");
return (NULL);
}
i = 0;
while (i < data->nb_philos)
{
@ -82,7 +76,12 @@ void *check_routine(t_data *data)
return (NULL);
}
i++;
usleep(10);
if ((ssize_t) get_min_meal(data) >= data->nb_meals)
{
stop(data);
printf("g pu faim\n");
return (NULL);
}
}
}
}