42 lines
833 B
C
42 lines
833 B
C
#ifndef PHILO_HEADER_H
|
|
# define PHILO_HEADER_H
|
|
|
|
# include <stdlib.h>
|
|
# include <unistd.h>
|
|
# include <pthread.h>
|
|
# include <sys/time.h>
|
|
# include <stdio.h>
|
|
# include <string.h>
|
|
|
|
|
|
typedef struct s_philo
|
|
{
|
|
int right_fork;
|
|
int left_fork;
|
|
} t_philo;
|
|
|
|
typedef struct s_philo_data
|
|
{
|
|
pthread_mutex_t *mutex;
|
|
t_philo *philors;
|
|
} t_philo_data;
|
|
|
|
typedef struct s_all
|
|
{
|
|
int number_of_philosophers;
|
|
time_t time_to_die;
|
|
time_t time_to_eat;
|
|
time_t time_to_sleep;
|
|
int number_of_times_each_philosopher_must_eat;
|
|
t_philo_data *data_philo;
|
|
} t_all;
|
|
|
|
void *ft_calloc(size_t num, size_t size);
|
|
t_all *structalloc_and_bzero(void);
|
|
int parse_and_check_values(char **argv, int quantity);
|
|
int ft_atoi(const char *str);
|
|
int check_f(char ch);
|
|
int runner(t_all *all, int optional);
|
|
|
|
#endif
|