#include "philo.h"

int check_alive(t_philo *philo)
{
	if (get_time() - philo->last_meal > philo->rules->time_to_die)
	{
		print_status(philo, "died");
		philo->death = 1;
		pthread_mutex_lock(philo->rules->death_lock);
		philo->rules->death = 1;
		pthread_mutex_unlock(philo->rules->death_lock);
		pthread_mutex_unlock(philo->l_fork);
		pthread_mutex_unlock(philo->r_fork);
		return (FAILURE);
	}
	return (SUCCESS);
}