diff --git a/philo.c b/philo.c index 65424d8..be2df7a 100644 --- a/philo.c +++ b/philo.c @@ -19,6 +19,13 @@ bool check(t_philo *philo, t_data *data) { bool stop; + if (get_min_meal(data) == data->nb_meals) + { + pthread_mutex_lock(&philo->stop_mutex); + philo->stop = 1; + pthread_mutex_unlock(&philo->stop_mutex); + return (1); + } pthread_mutex_lock(&data->stop_mutex); stop = data->stop; pthread_mutex_unlock(&data->stop_mutex);