#ifndef PHILO_H # define PHILO_H # include # include # include # include # include # include # include # define SUCCESS 1 # define FAILURE 0 # define ERROR_USAGE "Usage: ./philo number_of_philosophers time_to_die " \ "time_to_eat time_to_sleep [number_of_times_each_philosopher_must_eat]\n" # define ERROR_MUTEX "Can not create mutex" # define ERROR_MALLOC "Malloc Failure" typedef struct s_rules { int n_philos; int time_to_die; int time_to_eat; int time_to_sleep; int n_must_eat; pthread_mutex_t *print; pthread_mutex_t *death; pthread_mutex_t *forks; t_philo *philos; } t_rules; typedef struct s_philo { int id; pthread_t *pid; pthread_mutex_t *l_fork; pthread_mutex_t *r_fork; int death; int last_meal; t_rules *rules; } t_philo; // memset, printf, malloc, free, write, // usleep, gettimeofday, pthread_create, // pthread_detach, pthread_join, pthread_mutex_init, // pthread_mutex_destroy, pthread_mutex_lock, // pthread_mutex_unlock int ph_atoi(const char *nptr, int *res); #endif