fix: stop when philo has enough eat
This commit is contained in:
parent
26e9f21238
commit
b553e5af97
13
main.c
13
main.c
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user