/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* philo.h :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: dkaiser # include # include # include # define ERR_USAGE "Usage: [times_must_eat]" # define ERR_MALLOC "Memory allocation failed" typedef struct s_fork { int owner; pthread_mutex_t mutex; } t_fork; typedef struct s_phdata { int nbr_of_philos; int time_to_die; int time_to_eat; int time_to_sleep; int times_must_eat; int philos_must_eat; pthread_mutex_t pme_mutex; int simulation_running; t_fork *forks; } t_phdata; typedef struct s_philo { int id; int last_time_eaten; int times_must_eat; int is_alive; pthread_t thread; t_phdata *data; } t_philo; int run_simulation(int nbr_of_philos, t_philo *philos, t_phdata *data); int philo_die(t_philo *philo); void philo_eat(t_philo *philo); #endif