/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* philo_two.h :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: cacharle +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/14 22:47:23 by cacharle #+# #+# */ /* Updated: 2020/09/30 10:02:50 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ #ifndef PHILO_TWO_H # define PHILO_TWO_H # include # include # include # include # include "common.h" typedef struct { long int philo_num; t_time timeout_death; t_time timeout_eat; t_time timeout_sleep; long int meal_num; bool all_alive; pthread_mutex_t mutex_stdout; } t_philo_conf; typedef struct { long int id; t_philo_conf *conf; t_time time_last_eat; sem_t *forks; } t_philo; /* ** routine.c */ void *routine_philo(t_philo *arg); void *routine_death(t_philo *arg); t_philo *routine_create_philos(t_philo_conf *conf, sem_t *forks); /* ** io.c */ void event_take_fork(t_philo *arg); void event_eat(t_philo *arg); void event_think(t_philo *arg); void event_sleep(t_philo *arg); void event_die(t_philo *arg); #endif