fix: stop when nb_meal is reached

This commit is contained in:
Camille Chauvet
2023-04-25 14:50:01 +00:00
parent 891431c1be
commit 02a80af93b
4 changed files with 8 additions and 5 deletions

View File

@ -63,6 +63,9 @@ bool philo_eat(t_philo *philo, t_data *data)
pthread_mutex_lock(&philo->last_eat_mutex);
philo->last_eat = get_time();
pthread_mutex_unlock(&philo->last_eat_mutex);
pthread_mutex_lock(&philo->nb_meal_mutex);
philo->nb_meal++;
pthread_mutex_unlock(&philo->nb_meal_mutex);
return (0);
}